Commit Graph

5021 Commits (pan-zoom)

Author SHA1 Message Date
Nick O'Leary 7b6c838e7e
Reshow scrollbars and disable navigator temporary show 2025-10-31 11:29:37 +00:00
Nick O'Leary 351d25a7d6
Fix nls message name 2025-10-31 11:29:37 +00:00
Nick O'Leary ccf8772dc0
Merge branch 'master' into pan-zoom 2025-10-30 14:18:51 +00:00
Nick O'Leary 9d019e25c2
Fix up port event cancelling on node-select 2025-10-29 17:50:50 +00:00
Nick O'Leary 603a6f0c11
Merge pull request #5337 from node-red/selection-to-subflow-menu
Add selection-to-subflow context menu item
2025-10-29 17:40:26 +00:00
Nick O'Leary ea5c134866
Merge pull request #5315 from stoprocent/master
Fix race condition in projects initialization by returning gitTools.init() promise
2025-10-29 17:32:20 +00:00
Nick O'Leary 18f2285a48
Add selection-to-subflow context menu item 2025-10-29 17:31:23 +00:00
Nick O'Leary c015645c03
Merge pull request #5325 from node-red/5319-subflow-port-fixes
Show subflow input label on virtual port
2025-10-29 17:16:27 +00:00
Nick O'Leary e9fa3f0a2b
Merge pull request #5323 from node-red/5244-clear-suggestions
Clear suggestions on node/port mouse down
2025-10-29 17:16:17 +00:00
Nick O'Leary 6924b399cc
Fix lock icon for read-only user 2025-10-29 15:29:35 +00:00
Nick O'Leary fe4d40a776
Show subflow input label on virtual port 2025-10-23 15:37:07 +01:00
Nick O'Leary 6bb32775ba
Clear suggestions on node/port mouse down
Closes #5244
2025-10-23 13:52:44 +01:00
Nick O'Leary c9e0aaf34e
Make zoom scale 1 sticky to make it easier to get to 2025-10-21 09:24:58 +01:00
Nick O'Leary fa05811b08
Fix linting 2025-10-20 13:20:30 +01:00
Nick O'Leary 6813f373c6
Fix issues with navigator show/hide lifecycle 2025-10-20 13:15:52 +01:00
Nick O'Leary 3bbdc77300
Fix up space-to-pan event handling 2025-10-20 13:15:37 +01:00
Nick O'Leary 9cedcd0a78
Add nls message for zoom to fit 2025-10-20 13:15:09 +01:00
Marek Serafin 25e92c3501 Fix race condition in projects initialization
Add missing return statement for gitTools.init() promise to ensure
activeProject is set before getFlows() is called during startup.

Fixes intermittent 'No active project' warnings when projects feature
is enabled.
2025-10-18 18:04:06 +02:00
GogoVega ced0b30632
Fixe a typo in the variable name 2025-10-16 17:06:05 +02:00
dimitrieh 1638fa927b
Fix mouse wheel zoom sensitivity by detecting input device type
Mouse wheel events were being treated as trackpad input, causing excessive zoom jumps. Added delta magnitude detection (threshold: 50) to distinguish between mouse wheel (large deltas) and trackpad (small deltas), applying appropriate zoom calculation for each device.
2025-10-14 10:04:35 +01:00
dimitrieh 1ff980d190
Increase maximum zoom level to 2.0 2025-10-14 10:04:35 +01:00
dimitrieh 250f7ab897
Add minimap auto-show on flow startup and workspace changes
Shows minimap briefly when:
- Flow initially loads (if nodes exist)
- Switching between workspace tabs
- Continuing to show during zoom/pan navigation

Implementation:
- Listen to workspace:change events
- Check for active workspace with nodes before showing
- Use 100ms delay to ensure nodes are rendered
- Reuse existing showTemporary() for consistent behavior
2025-10-14 10:04:35 +01:00
dimitrieh d308bc7763
Remove debug console logs and update documentation 2025-10-14 10:04:35 +01:00
dimitrieh 79581bf51f
Refresh active nodes before zoom-to-fit to work immediately 2025-10-14 10:04:35 +01:00
dimitrieh f831df70ce
Fix zoom-to-fit to properly center nodes in viewport 2025-10-14 10:04:35 +01:00
dimitrieh 34d356230b
Set maximum zoom level to 1.0 2025-10-14 10:04:34 +01:00
dimitrieh 37a4440a5a
Make zoom animation duration relative to maintain consistent velocity 2025-10-14 10:04:34 +01:00
dimitrieh f22915e1b9
Add grabbing cursor for middle-click pan mode 2025-10-14 10:04:34 +01:00
dimitrieh 775d6181c9
Add grab/grabbing cursor for spacebar pan mode
- Show grab cursor (open hand) when spacebar is pressed
- Show grabbing cursor (closed hand) when actively panning with spacebar+drag
- Revert to grab cursor on mouse release if spacebar still held
- Clear cursor when spacebar is released
- Apply cursor to SVG element (outer) where mouse events occur
- Handle edge cases: window blur, canvas blur, spacebar release outside canvas
2025-10-14 10:04:34 +01:00
dimitrieh 47026ec744
Add minimap auto-show for zoom button/hotkey interactions
- Emit view:navigate event in animatedZoomView onStart callback
- Minimap now appears when using zoom buttons (in/out/reset/fit)
- Minimap now appears when using zoom hotkeys (Ctrl+/-/0/1)
- Auto-hides after 2 seconds as expected
- Applies to all animated zoom operations consistently
2025-10-14 10:04:34 +01:00
dimitrieh 79918f0187
Add focal point locking for sequential button/hotkey zooms
- Store workspace center on first button/hotkey zoom operation
- Maintain same focal point for sequential zooms within 1 second timeout
- Pass workspace center directly to animatedZoomView to prevent recalculation
- Focal point always at viewport center with consistent workspace point
- Works correctly at canvas edges where viewport may shift
- Does not interfere with wheel/pinch zoom which provide explicit focal points
2025-10-14 10:04:34 +01:00
dimitrieh 95b750060f
Fix zoom button animation and improve performance
- Fixed viewport jump to 0,0 by preventing click event from being passed as focal point
- Added smooth animation to zoom buttons and keyboard shortcuts (animatedZoomView)
- Doubled zoom step from 0.1 to 0.2 for faster zooming
- Optimized animation performance by only updating transforms during animation frames
- Fixed undefined variable issue (vis/gridScale -> eventLayer/outer)
- Full redraw only happens once at end of animation, eliminating jarring experience
2025-10-14 10:04:33 +01:00
dimitrieh 324ca52516
Fix zoom center calculation to use oldScaleFactor consistently 2025-10-14 10:04:33 +01:00
dimitrieh a1854806af
Fix viewport drift when using zoom buttons without focal point 2025-10-14 10:04:33 +01:00
dimitrieh 8286ec8131
Remove animation from zoom buttons for instant, smooth zooming
Replace animatedZoomView() with direct zoomView() calls for zoom
buttons and keyboard shortcuts to eliminate jagged animation caused
by redraw() being called on every frame.

- Change zoomIn/zoomOut/zoomZero to use instant zoom like trackpad
- Single redraw per zoom step instead of 8-10 redraws during animation
- Makes all zoom methods (buttons, keyboard, trackpad) feel consistent
- Keep animatedZoomView() only for zoomToFitAll() where animation helps

Fixes stuttering when zooming with buttons or Ctrl+/-/0 shortcuts.
2025-10-14 10:04:33 +01:00
dimitrieh f74beb6a92
Add Ctrl+1/Cmd+1 keyboard shortcut for zoom-to-fit 2025-10-14 10:04:33 +01:00
dimitrieh f6decfd589
Revert "Move zoom-to-fit button between reset and zoom-in"
This reverts commit e46cfc9479b2db429d4f73c981e1886b6c0cbbca.
2025-10-14 10:04:33 +01:00
dimitrieh 269cab2e9c
Move zoom-to-fit button between reset and zoom-in 2025-10-14 10:04:32 +01:00
dimitrieh e2a6a1b52d
Fix zoom button handlers - zoom in/out were reversed 2025-10-14 10:04:32 +01:00
dimitrieh c5209d8ea2
Add zoom-to-fit button to show all nodes at once
Add fourth zoom button that calculates bounding box of all active nodes
and zooms out to fit them all in viewport with padding.

- Add compress icon button to zoom controls in footer
- Implement zoomToFitAll() function with bounding box calculation
- Add 80px padding around nodes for visual breathing room
- Respect dynamic minimum zoom limit
- Center viewport on bounding box after zoom animation
- Register core:zoom-fit action for keyboard shortcut support
- Update documentation with new zoom-to-fit feature
2025-10-14 10:04:32 +01:00
dimitrieh 48b6fb353d
Fix grey padding at canvas bottom by resetting SVG margins
Remove 5px grey space that appeared at bottom of canvas when scrolled
to maximum position. The viewport scrollHeight was 8005px instead of
8000px due to default browser SVG margins.

- Add explicit padding and margin resets to workspace chart container
- Set SVG to display:block with zero margin/padding to prevent spacing
- Ensures scrollable area exactly matches 8000px canvas dimensions
2025-10-14 10:04:32 +01:00
dimitrieh f718069b46
Fix minimap viewport position at non-1.0 zoom levels
The minimap was treating scroll position as workspace coordinates,
but scrollLeft/scrollTop are actually in scaled canvas pixels.

At zoom levels other than 1.0, this caused the viewport rectangle
to appear in the wrong position. For example, at 2x zoom viewing
workspace position (500, 500), the scroll position would be 1000px,
and the minimap would incorrectly show it at workspace position 1000.

Fixed by converting scroll position to workspace coordinates first:
position = scrollPos / scaleFactor / nav_scale

The viewport rectangle now accurately reflects the actual visible
area at all zoom levels.
2025-10-14 10:04:32 +01:00
dimitrieh cdde99b9ab
Add scroll spacer to fix scrollable area at minimum zoom
When at minimum zoom with "cover" behavior, the SVG canvas may be
smaller than the viewport in one dimension. This causes the browser's
scrollWidth/scrollHeight to be limited by the SVG size rather than
the full canvas extent.

Added an invisible spacer div that matches the scaled canvas dimensions,
ensuring the scrollable area always reflects the actual canvas size.
This allows proper scrolling to reach all canvas edges without going
beyond canvas boundaries.
2025-10-14 10:04:32 +01:00
dimitrieh f132867a31
Add stable focal point tracking to Alt/Space scroll zoom
Alt+scroll and Space+scroll zoom now maintain a fixed focal point
like trackpad pinch zoom. Previously, the zoom point would drift
during continuous scrolling.

Implemented gesture session tracking that:
- Stores focal point in workspace coordinates for stability
- Locks focal point during continuous scroll events (< 100ms apart)
- Ends gesture after 500ms of inactivity
- Converts focal point back to screen coordinates for each zoom step

This makes all zoom methods (pinch, Alt+scroll, Space+scroll) behave
consistently with stable, cursor-centered zooming.
2025-10-14 10:04:31 +01:00
dimitrieh c07cce4fb0
Make Alt/Space scroll zoom speed match trackpad pinch zoom
Alt+scroll and Space+scroll were using fixed zoom steps (0.06/0.08),
making them zoom much faster than trackpad pinch zoom which uses
proportional scaling (0.005 * delta).

Changed to use trackpad-style proportional zoom for consistent feel
across all zoom input methods.
2025-10-14 10:04:31 +01:00
dimitrieh 45f3b01125
Fix spacebar hold causing unwanted canvas scrolling
When holding spacebar, browsers fire repeated keydown events. The
previous implementation only prevented default on the first keydown,
allowing subsequent events to trigger browser's space-scroll behavior.

Moved preventDefault() outside conditional to block all spacebar events.
2025-10-14 10:04:31 +01:00
dimitrieh 3bef2d6481
Improve minimap auto-show behavior
- Remove view:selection-changed listener to prevent minimap showing on node selection
- Remove view:navigate emissions from pan mode entry points (no longer shows when starting pan)
- Add view:navigate emission to touchpad scroll handler for consistent behavior
- Minimap now only appears during actual panning and zooming actions

The minimap previously showed when selecting nodes or just starting a pan gesture,
causing unnecessary flashing. Now it only appears during actual navigation (pan/zoom)
and fades after 2 seconds of inactivity.
2025-10-14 10:04:31 +01:00
dimitrieh 08a5d04df6
Enable diagonal trackpad panning
- Prevent browser's native axis-locked scroll behavior
- Manually handle both deltaX and deltaY in wheel event handler
- Update touch-action CSS from pan-x pan-y to manipulation
- Add documentation of fix to CANVAS_INTERACTION.md

Fixes issue where trackpad scrolling was restricted to horizontal
or vertical movement only, not both simultaneously.
2025-10-14 10:04:31 +01:00
Dimitrie Hoekstra 6725fd6426
Hide scrollbars and add auto-show/hide minimap on navigation
- Hide scrollbars on canvas while keeping it scrollable
- Add minimap auto-show functionality that triggers on zoom and pan
- Minimap appears for 2 seconds during navigation then fades out
- Add smooth fade in/out animations for minimap visibility
- Emit view:navigate events for all zoom and pan operations
- Minimap stays visible if manually toggled with button
2025-10-14 10:04:31 +01:00
Dimitrie Hoekstra 7dca55fdb8
Add dynamic minimum zoom recalculation on viewport resize
- Recalculate minimum zoom when window resizes to ensure canvas fits properly
- Automatically adjust zoom if current level falls below new minimum after resize
- Ensures canvas boundaries remain appropriate for different viewport sizes
2025-10-14 10:04:30 +01:00