fix(core): use computed var to get node in drag handler

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-01-18 23:07:26 +01:00
committed by Braks
parent 00681e5321
commit c13d28d5e2

View File

@@ -42,12 +42,13 @@ function useDrag(params: UseDragParams) {
let lastPos = $ref<Partial<XYPosition>>({ x: undefined, y: undefined })
let dragHandler = $ref<any>()
const node = $computed(() => (id ? findNode(id) : undefined))
const getPointerPosition = useGetPointerPosition()
watch([() => disabled, () => el], () => {
if (el) {
const selection = select(el)
const node = id ? findNode(id) : undefined
if (disabled) {
selection.on('.drag', null)