summaryrefslogtreecommitdiff
path: root/pages/index.tsx
diff options
context:
space:
mode:
authorKirill Rogovoy <[email protected]>2021-08-09 15:26:06 +0300
committerKirill Rogovoy <[email protected]>2021-08-09 15:26:06 +0300
commit7fef1ce06d9b48983f3295129dddfab3cd242436 (patch)
tree28ab2b7bdf679316750ee315fd4e0f9c0d39feb4 /pages/index.tsx
parent410be28d0ad7e3f792392bb23e8f09e9becf4762 (diff)
fix: broken lock files + double click
Diffstat (limited to 'pages/index.tsx')
-rw-r--r--pages/index.tsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index 42170a1..e2cda84 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1038,12 +1038,20 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) {
onNodeClick: (nodeArg: NodeObject, event: any) => {
const node = nodeArg as OrgRoamNode
contextMenu.onClose()
- const isDoubleClick = event.timeStamp - lastNodeClickRef.current < 400
+ const doubleClickTimeBuffer = 200
+ const isDoubleClick = event.timeStamp - lastNodeClickRef.current < doubleClickTimeBuffer
lastNodeClickRef.current = event.timeStamp
if (isDoubleClick) {
return handleClick('double', node, event)
}
- return handleClick('click', node, event)
+
+ const prevNodeClickTime = lastNodeClickRef.current
+ return setTimeout(() => {
+ if (lastNodeClickRef.current !== prevNodeClickTime) {
+ return
+ }
+ return handleClick('click', node, event)
+ }, doubleClickTimeBuffer)
},
onBackgroundClick: () => {
contextMenu.onClose()