2
0

🐛 (editor) Fix dragging locked when window is blurred while pressing keys

Closes #1311
This commit is contained in:
Baptiste Arnaud
2024-03-15 12:19:43 +01:00
parent 70cc1f0ce3
commit 065a70ea28

View File

@ -23,7 +23,6 @@ import { isSelectBoxIntersectingWithElement } from '../helpers/isSelectBoxInters
import { useGroupsStore } from '../hooks/useGroupsStore'
import { useShallow } from 'zustand/react/shallow'
import { projectMouse } from '../helpers/projectMouse'
import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts'
import { useUser } from '@/features/account/hooks/useUser'
import { GraphNavigation } from '@typebot.io/prisma'
@ -305,8 +304,6 @@ export const Graph = ({
setAutoMoveDirection(undefined)
}
useKeyboardShortcuts({})
useEventListener('keydown', (e) => {
if (e.key === ' ') setIsDraggingGraph(true)
})
@ -317,6 +314,16 @@ export const Graph = ({
}
})
useEventListener(
'blur',
() => {
setIsDraggingGraph(false)
setIsDragging(false)
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window as any
)
useEventListener('mousedown', handleCaptureMouseDown, undefined, {
capture: true,
})