aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-04-27 18:20:22 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-04-27 18:20:22 +0530
commit7a51214ef9b5b387c614b0139987a2c94d49b902 (patch)
treeaf148c045205d5f165336c69ff3295fa0c699ada /src/Utils.ts
parent20beef06518bfa08db60b8c5a06c637dab0f2b92 (diff)
parent0dfe3d9f0790f499b380cbafcef40cfbe0c7ad29 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into grid_view_secondary
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 9acdc8731..ad12c68a1 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -504,8 +504,9 @@ export function setupMoveUpEvents(
e: React.PointerEvent,
moveEvent: (e: PointerEvent, down: number[], delta: number[]) => boolean,
upEvent: (e: PointerEvent) => void,
- clickEvent: (e: PointerEvent) => void,
- stopPropagation: boolean = true
+ clickEvent: (e: PointerEvent, doubleTap?: boolean) => void,
+ stopPropagation: boolean = true,
+ stopMovePropagation: boolean = true
) {
(target as any)._downX = (target as any)._lastX = e.clientX;
(target as any)._downY = (target as any)._lastY = e.clientY;
@@ -520,12 +521,15 @@ export function setupMoveUpEvents(
}
(target as any)._lastX = e.clientX;
(target as any)._lastY = e.clientY;
- e.stopPropagation();
+ stopMovePropagation && e.stopPropagation();
};
+ (target as any)._doubleTap = false;
const _upEvent = (e: PointerEvent): void => {
+ (target as any)._doubleTap = (Date.now() - (target as any)._lastTap < 300);
+ (target as any)._lastTap = Date.now();
upEvent(e);
if (Math.abs(e.clientX - (target as any)._downX) < 4 && Math.abs(e.clientY - (target as any)._downY) < 4) {
- clickEvent(e);
+ clickEvent(e, (target as any)._doubleTap);
}
document.removeEventListener("pointermove", _moveEvent);
document.removeEventListener("pointerup", _upEvent);