mirror of https://github.com/node-red/node-red.git
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.pan-zoom
parent
45f3b01125
commit
c07cce4fb0
|
|
@ -849,11 +849,12 @@ RED.view = (function() {
|
|||
}, gestureEndThreshold); // Use 500ms timeout for gesture end detection
|
||||
} else {
|
||||
// Regular Alt+scroll or Space+scroll - use smooth zoom without animation
|
||||
// Use the zoom animator's delta calculation for mouse wheel
|
||||
var scaleDelta = RED.view.zoomAnimator.calculateZoomDelta(scaleFactor, -delta, false);
|
||||
var newScale = Math.min(RED.view.zoomConstants.MAX_ZOOM,
|
||||
Math.max(RED.view.zoomConstants.MIN_ZOOM, scaleFactor + scaleDelta));
|
||||
|
||||
// Use same proportional zoom as trackpad for consistent feel
|
||||
var scaleDelta = RED.view.zoomAnimator.calculateZoomDelta(scaleFactor, -delta, true);
|
||||
var minZoom = calculateMinZoom();
|
||||
var newScale = Math.min(RED.view.zoomConstants.MAX_ZOOM,
|
||||
Math.max(minZoom, scaleFactor + scaleDelta));
|
||||
|
||||
// Only zoom if scale is actually changing
|
||||
if (Math.abs(scaleFactor - newScale) >= 0.001) {
|
||||
zoomView(newScale, cursorPos); // Direct call, no animation for smoother feel
|
||||
|
|
|
|||
Loading…
Reference in New Issue