Skip to content

Commit

Permalink
remove fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
shaodahong committed Feb 2, 2021
1 parent 9ceb215 commit 1e737b7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ const Preview: React.FC<PreviewProps> = props => {
setPosition(initialPosition);
};

const onZoomIn = useCallback(() => {
const onZoomIn = () => {
setScale(value => value + 1);
setPosition(initialPosition);
});
};

const onZoomOut = useCallback(() => {
const onZoomOut = () => {
if (scale > 1) {
setScale(value => value - 1);
}
setPosition(initialPosition);
});
};

const onRotateRight = () => {
setRotate(value => value + 90);
Expand Down Expand Up @@ -196,7 +196,7 @@ const Preview: React.FC<PreviewProps> = props => {
} else if (wheelDirection < 0) {
onZoomIn();
}
}, [lastWheelZoomDirection, onZoomIn, onZoomOut]);
}, [lastWheelZoomDirection]);

useEffect(() => {
let onTopMouseUpListener;
Expand Down Expand Up @@ -230,7 +230,7 @@ const Preview: React.FC<PreviewProps> = props => {
/* istanbul ignore next */
if (onTopMouseMoveListener) onTopMouseMoveListener.remove();
};
}, [visible, isMoving, onMouseUp, onMouseMove, onWheelMove]);
}, [visible, isMoving]);

return (
<Dialog
Expand Down

0 comments on commit 1e737b7

Please sign in to comment.