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