mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15: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();
|
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,
|
||||||
|
|||||||
Reference in new issue
Block a user