Skip to content

Commit 4a5b631

Browse files
committed
fix(zoom): improve pinch zoom accuracy
1 parent 659d880 commit 4a5b631

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/plugins/zoom/hooks/useZoomState.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ export function useZoomState(
5555
const changeZoom = React.useCallback(
5656
(targetZoom: number, rapid?: boolean, dx?: number, dy?: number) => {
5757
const newZoom = round(
58-
Math.min(Math.max(targetZoom + 0.001 < maxZoom ? targetZoom : maxZoom, minZoom), maxZoom),
58+
targetZoom + 0.01 < maxZoom ? (targetZoom - 0.01 > minZoom ? targetZoom : minZoom) : maxZoom,
5959
5,
6060
);
6161

62-
if (newZoom === zoom) return;
63-
6462
if (!rapid) {
6563
animate();
6664
}

0 commit comments

Comments
 (0)