🐛 (editor) Fix dragging locked when window is blurred while pressing keys
Closes #1311
This commit is contained in:
@ -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,
|
||||
})
|
||||
|
Reference in New Issue
Block a user