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.
pull/5312/head
dimitrieh 2025-09-30 13:43:36 +02:00 committed by Nick O'Leary
parent f74beb6a92
commit 8286ec8131
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 3 additions and 3 deletions

View File

@ -2847,16 +2847,16 @@ RED.view = (function() {
function zoomIn(focalPoint) {
if (scaleFactor < RED.view.zoomConstants.MAX_ZOOM) {
animatedZoomView(scaleFactor + RED.view.zoomConstants.ZOOM_STEP, focalPoint);
zoomView(scaleFactor + RED.view.zoomConstants.ZOOM_STEP, focalPoint);
}
}
function zoomOut(focalPoint) {
var minZoom = calculateMinZoom();
if (scaleFactor > minZoom) {
animatedZoomView(Math.max(scaleFactor - RED.view.zoomConstants.ZOOM_STEP, minZoom), focalPoint);
zoomView(Math.max(scaleFactor - RED.view.zoomConstants.ZOOM_STEP, minZoom), focalPoint);
}
}
function zoomZero() { animatedZoomView(1); }
function zoomZero() { zoomView(1); }
function zoomToFitAll() {
// Get all nodes in active workspace