1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

better click detection

This commit is contained in:
Fedor Katurov 2020-04-27 11:14:43 +07:00
parent 6d679ffd29
commit 35210c1d59

View file

@ -183,8 +183,7 @@ const NodeImageSlideBlock: FC<IProps> = ({
setIsDragging(false);
normalizeOffset();
if (Math.abs(+new Date() - drag_start) < 200) {
// click detection
if (Math.abs(new Date().getTime() - drag_start) < 200 && initial_x - getX(event) < 50) {
onOpenPhotoSwipe();
}
},
@ -196,7 +195,7 @@ const NodeImageSlideBlock: FC<IProps> = ({
setIsDragging(true);
setInitialX(getX(event));
setInitialOffset(offset);
setDragStart(+new Date());
setDragStart(new Date().getTime());
},
[setIsDragging, setInitialX, offset, setInitialOffset, setDragStart]
);