Skip to content

Commit

Permalink
fix conditions
Browse files Browse the repository at this point in the history
Signed-off-by: harupy <hkawamura0130@gmail.com>
  • Loading branch information
harupy committed Apr 27, 2022
1 parent f1d16ac commit 27a0fa9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,13 @@ const Preview: React.FC<PreviewProps> = props => {
);

const onDoubleClick = () => {
if (visible && scale !== 1) {
setScale(1);
setPosition(initialPosition);
if (visible) {
if (scale !== 1) {
setScale(1);
}
if (position.x !== initialPosition.x || position.y !== initialPosition.y) {
setPosition(initialPosition);
}
}
};

Expand Down

0 comments on commit 27a0fa9

Please sign in to comment.