fix(app): pan zoomed media with the scroll wheel (#1657)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-15 22:49:54 +02:00
1 parent fb718e7e5b
commit dcd3d9d08a
1 file changed
+11
@@ -450,6 +450,16 @@ export function usePanZoomSurface(options: UsePanZoomSurfaceOptions): PanZoomSur
event.preventDefault(); event.preventDefault();
stopAnimations(); stopAnimations();
const currentScale = scale.get(); const currentScale = scale.get();
if (!event.ctrlKey && !panDisabledRef.current && currentScale > minScaleRef.current + ZOOM_STATE_EPSILON) {
const pannedPoint = clampPanForScale(
{x: x.get() - event.deltaX, y: y.get() - event.deltaY},
currentScale,
metrics,
);
x.set(pannedPoint.x);
y.set(pannedPoint.y);
return;
}
const nextScale = clampScale( const nextScale = clampScale(
currentScale * getWheelZoomFactor(event.deltaY, event.ctrlKey), currentScale * getWheelZoomFactor(event.deltaY, event.ctrlKey),
minScaleRef.current, minScaleRef.current,
@@ -472,6 +482,7 @@ export function usePanZoomSurface(options: UsePanZoomSurfaceOptions): PanZoomSur
getViewportRelativePoint, getViewportRelativePoint,
maxScaleRef, maxScaleRef,
minScaleRef, minScaleRef,
panDisabledRef,
scale, scale,
stopAnimations, stopAnimations,
wheelEnabled, wheelEnabled,