mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
fix(app): pan zoomed media with the scroll wheel (#1657)
This commit is contained in:
1 parent
fb718e7e5b
commit
dcd3d9d08a
1 file changed
+11
+11
@@ -450,6 +450,16 @@ export function usePanZoomSurface(options: UsePanZoomSurfaceOptions): PanZoomSur
|
||||
event.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): PanZoomSur
|
||||
getViewportRelativePoint,
|
||||
maxScaleRef,
|
||||
minScaleRef,
|
||||
panDisabledRef,
|
||||
scale,
|
||||
stopAnimations,
|
||||
wheelEnabled,
|
||||
|
||||
Reference in new issue
Block a user