A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(app): pan zoomed media with the scroll wheel (#1657)
Hampusdcd3d9d08a40
diff --git a/fluxer_app/src/features/messaging/components/modals/media_modal/pan_zoom/usePanZoomSurface.ts b/fluxer_app/src/features/messaging/components/modals/media_modal/pan_zoom/usePanZoomSurface.tsindex dad433d0c..cb5534929 100644--- a/fluxer_app/src/features/messaging/components/modals/media_modal/pan_zoom/usePanZoomSurface.ts+++ b/fluxer_app/src/features/messaging/components/modals/media_modal/pan_zoom/usePanZoomSurface.ts@@ -450,6 +450,16 @@ export function usePanZoomSurface(options: UsePanZoomSurfaceOptions): PanZoomSurevent.preventDefault();stopAnimations();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(currentScale * getWheelZoomFactor(event.deltaY, event.ctrlKey),minScaleRef.current,@@ -472,6 +482,7 @@ export function usePanZoomSurface(options: UsePanZoomSurfaceOptions): PanZoomSurgetViewportRelativePoint,maxScaleRef,minScaleRef,+ panDisabledRef,scale,stopAnimations,wheelEnabled,