diff --git a/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts b/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts index 9e5acd4f..667484ab 100644 --- a/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts +++ b/src/client/lazy-app/Compress/Output/custom-els/PinchZoom/index.ts @@ -300,9 +300,13 @@ export default class PinchZoom extends HTMLElement { deltaY *= 15; } + const zoomingOut = deltaY > 0; + // ctrlKey is true when pinch-zooming on a trackpad. const divisor = ctrlKey ? 100 : 300; - const scaleDiff = 1 - deltaY / divisor; + // when zooming out, invert the delta and the ratio to keep zoom stable + const ratio = 1 - (zoomingOut ? -deltaY : deltaY) / divisor; + const scaleDiff = zoomingOut ? 1 / ratio : ratio; this._applyChange({ scaleDiff,