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
dimitrieh 2025-09-30 12:47:10 +02:00 committed by Nick O'Leary
parent 45f3b01125
commit c07cce4fb0
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 6 additions and 5 deletions

View File

@ -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