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:
parent
6d679ffd29
commit
35210c1d59
1 changed files with 2 additions and 3 deletions
|
@ -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]
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue