mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
better click detection
This commit is contained in:
parent
6d679ffd29
commit
35210c1d59
1 changed files with 2 additions and 3 deletions
|
@ -183,8 +183,7 @@ const NodeImageSlideBlock: FC<IProps> = ({
|
||||||
setIsDragging(false);
|
setIsDragging(false);
|
||||||
normalizeOffset();
|
normalizeOffset();
|
||||||
|
|
||||||
if (Math.abs(+new Date() - drag_start) < 200) {
|
if (Math.abs(new Date().getTime() - drag_start) < 200 && initial_x - getX(event) < 50) {
|
||||||
// click detection
|
|
||||||
onOpenPhotoSwipe();
|
onOpenPhotoSwipe();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -196,7 +195,7 @@ const NodeImageSlideBlock: FC<IProps> = ({
|
||||||
setIsDragging(true);
|
setIsDragging(true);
|
||||||
setInitialX(getX(event));
|
setInitialX(getX(event));
|
||||||
setInitialOffset(offset);
|
setInitialOffset(offset);
|
||||||
setDragStart(+new Date());
|
setDragStart(new Date().getTime());
|
||||||
},
|
},
|
||||||
[setIsDragging, setInitialX, offset, setInitialOffset, setDragStart]
|
[setIsDragging, setInitialX, offset, setInitialOffset, setDragStart]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue