Commit Graph

4997 Commits (f831df70cefb02a78d489d2a8f87848818f75ead)

Author SHA1 Message Date
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
Dimitrie Hoekstra b4c3faf034
Implement dynamic zoom limits to match canvas boundaries
- Add calculateMinZoom() function to dynamically compute minimum zoom based on viewport size
- Ensure canvas always covers the entire viewport (no empty space visible)
- Use 'cover' behavior: zoom limited so canvas fills viewport completely
- Update all zoom methods (buttons, wheel, trackpad, touch) to use calculated minimum
- Prevent zooming out beyond what's needed to fill the viewport with canvas content
2025-10-14 10:04:30 +01:00
Dimitrie Hoekstra 4938833227
Fix zoom gesture detection after two-finger panning
Clear touchStartTime timeout when entering two-finger pan mode to prevent
interference with subsequent zoom gestures. The timeout was being used for
long-press detection but wasn't cleared during pan, causing the next
gesture to incorrectly maintain the old touch state.
2025-10-14 10:04:30 +01:00
Dimitrie Hoekstra bf73261ecb
Prevent UI pinch-to-zoom while keeping canvas zoomable
- Add touch-action CSS to prevent pinch-zoom on UI elements
- Apply touch-action: pan-x pan-y to html, body, and editor
- Apply touch-action: none to canvas for custom gestures
- Add JavaScript prevention for touchpad pinch on non-canvas areas
- Block Ctrl+wheel events outside the workspace chart
2025-10-14 10:04:30 +01:00
Dimitrie Hoekstra 3e2fb85821
Add two-finger panning and spacebar+click panning
- Implement spacebar+left-click panning for desktop
- Add two-finger pan gesture for touch devices
- Use mode locking to prevent laggy gesture switching
- Lock into pan or zoom mode based on initial movement
- Fix focal point regression caused by pan/zoom interaction
- Improve gesture detection with better thresholds (10px for zoom, 5px for pan)
2025-10-14 10:04:30 +01:00
Dimitrie Hoekstra 541977312e
Improve zoom smoothness and control
- Make mouse wheel zoom smooth without jarring animations
- Reduce zoom acceleration from 2x to 1.2x max
- Slow down zoom velocity by 40-50% for better control
- Add asymmetric zoom speeds (zoom out slower than zoom in)
- Reduce acceleration range to 0.7-1.1 for gentler transitions
- Disable legacy mousewheel handler in favor of modern wheel event
2025-10-14 10:04:30 +01:00
Dimitrie Hoekstra 782821b590
Fix zoom focal point stability at canvas edges
- Store focal point in workspace coordinates instead of screen coordinates
- Prevents focal point drift when scroll changes due to canvas boundaries
- Maintains consistent zoom focus even when view shifts at edges
- Add early return in zoomView() to prevent unnecessary updates at zoom limits
- Improve gesture state management for both trackpad and touch gestures
2025-10-14 10:04:30 +01:00
Dimitrie Hoekstra 49222c5737
Fix trackpad zoom direction - spreading fingers now zooms in
- Inverted deltaY value for trackpad pinch gestures
- Matches standard macOS trackpad behavior
- Spreading fingers (negative deltaY) zooms in
- Pinching fingers (positive deltaY) zooms out
2025-10-14 10:04:29 +01:00
Dimitrie Hoekstra eaf68815fd
Implement smooth zoom functionality with pinch-to-zoom support
- Add smooth zoom animation with 125ms duration and easing curves
- Implement space+scroll zoom mode alongside existing Alt+scroll
- Fix pinch-to-zoom with proper ratio-based scaling and fixed focal point
- Add gesture state management for consistent zoom behavior
- Enhance spacebar handling to prevent scroll artifacts
- Fix zoom button layout (correct zoom in/out direction)
- Add zoom animation utilities (view-zoom-animator.js)
- Add zoom configuration constants (view-zoom-constants.js)
- Fix scale lock issues with improved tolerance handling
- Update Gruntfile to include new zoom modules in build

Features implemented:
- Smooth animated zoom transitions (125ms with ease-out)
- Space+scroll for zoom mode
- Fixed focal point during pinch gestures
- No scroll artifacts when pressing space
- Proper state management when cursor leaves canvas
- Natural acceleration/deceleration curves

Known issue: Trackpad pinch-to-zoom needs additional work on macOS
2025-10-14 10:04:29 +01:00
claude[bot] bd51b0c153
feat: Add enhanced zoom and scroll features
- Added space+scroll zoom functionality
- Implemented cursor-centered zoom (focuses on cursor position)
- Enhanced pinch-to-zoom with trackpad support (Ctrl+wheel)
- Added momentum scrolling with edge bounce animation
- Improved touch pinch gesture handling with proper center tracking

Co-authored-by: Dimitrie Hoekstra <dimitrieh@users.noreply.github.com>
2025-10-14 10:04:28 +01:00
Nick O'Leary 2f2199e71b
Bump for 4.1.1 release 2025-10-13 11:37:18 +01:00
Nick O'Leary 7f6abd15b0
Merge pull request #5310 from node-red/5236-add-missing-log
Simplify error logging when issue in settings file
2025-10-13 11:33:44 +01:00
Nick O'Leary 535366d742
Simplify error logging when issue in settings file 2025-10-13 11:26:54 +01:00
Nick O'Leary c9b7263e21
Merge pull request #5300 from node-red/5287-fix-httpin-middleware-handling
Do not assume rawBody middleware is last in stack when moving it
2025-10-13 11:17:20 +01:00
Nick O'Leary 2c1fe60d25
Merge pull request #5307 from GogoVega/5245-filter-suggestions-for-disabled-set
Filter suggestions to ensure only enabled set are shown
2025-10-13 11:12:12 +01:00
Nick O'Leary b5edcf6ac9
Update packages/node_modules/@node-red/editor-client/src/js/ui/view.js 2025-10-13 11:06:30 +01:00
Nick O'Leary 6d1fd0b616
Show all catalog items if small enough and no search time provided 2025-10-13 10:56:40 +01:00
GogoVega c1cd5d9593
Filter suggestions to ensure only enabled set are shown 2025-10-10 18:16:25 +02:00
Nick O'Leary 5427d43a98
Merge pull request #5306 from node-red/5244-redraw-after-clearing-suggestion
Force a redraw after clearing suggested flow on mouse down
2025-10-10 16:03:36 +01:00
Nick O'Leary f4cbebca66
Merge pull request #5299 from joebordes/i18n_003
i18n(NodeRed) update ES translation files to latest code base
2025-10-10 15:50:48 +01:00
Nick O'Leary 4173e9a71b
Force a redraw after clearing suggested flow on mouse down 2025-10-10 15:47:31 +01:00
Nick O'Leary e85476b925
Merge pull request #5301 from node-red/5245-filter-suggestions-for-known-types
Filter suggestions to ensure only known types are shown
2025-10-10 15:06:00 +01:00
GogoVega 7c1505eeaf
Use the action label if provided 2025-10-10 13:38:03 +02:00
Nick O'Leary 00b879f855
Filter suggestions to ensure only known types are shown 2025-10-10 12:02:36 +01:00
Nick O'Leary 471f0d8bea
Do not assume rawBody middleware is last in stack when moving it 2025-10-10 11:35:27 +01:00