update(node): defer update pos to nexttick
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -60,7 +60,7 @@ const onDragStart: DraggableEventListener = ({ event }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onDrag: DraggableEventListener = ({ event, data: { deltaX, deltaY } }) => {
|
const onDrag: DraggableEventListener = ({ event, data: { deltaX, deltaY } }) => {
|
||||||
store.updateNodePosition({ id: node.value.id, diff: { x: deltaX, y: deltaY }, dragging: true })
|
nextTick(() => store.updateNodePosition({ id: node.value.id, diff: { x: deltaX, y: deltaY }, dragging: true }))
|
||||||
store.hooks.nodeDrag.trigger({ event, node: node.value })
|
store.hooks.nodeDrag.trigger({ event, node: node.value })
|
||||||
}
|
}
|
||||||
const onDragStop: DraggableEventListener = ({ event, data: { deltaX, deltaY } }) => {
|
const onDragStop: DraggableEventListener = ({ event, data: { deltaX, deltaY } }) => {
|
||||||
@@ -96,15 +96,17 @@ onMounted(() => {
|
|||||||
watch(
|
watch(
|
||||||
dimensions,
|
dimensions,
|
||||||
({ width: w, height: h }) => {
|
({ width: w, height: h }) => {
|
||||||
if (w > 0 && h > 0) {
|
nextTick(() => {
|
||||||
const handleBounds = getHandleBounds(nodeElement.value, store.transform[2], store.id)
|
if (w > 0 && h > 0) {
|
||||||
|
const handleBounds = getHandleBounds(nodeElement.value, store.transform[2], store.id)
|
||||||
|
|
||||||
node.value.dimensions = {
|
node.value.dimensions = {
|
||||||
width: w,
|
width: w,
|
||||||
height: h,
|
height: h,
|
||||||
|
}
|
||||||
|
node.value.handleBounds = handleBounds
|
||||||
}
|
}
|
||||||
node.value.handleBounds = handleBounds
|
})
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user