fix(core): only emit position changes if change occurred (#1939)

* fix(core): only emit position changes if a position change occurred

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

* chore(changeset): add

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

---------

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2025-08-31 14:09:54 +02:00
parent a433f3512d
commit 2bacaa8b2d
2 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@vue-flow/core": patch
---
Only emit node position changes if a position change actually occurred.

View File

@@ -74,6 +74,7 @@ export function useDrag(params: UseDragParams) {
let mousePosition: XYPosition = { x: 0, y: 0 }
let dragEvent: MouseEvent | null = null
let dragStarted = false
let nodePositionsChanged = false
let autoPanId = 0
let autoPanStarted = false
@@ -104,6 +105,8 @@ export function useDrag(params: UseDragParams) {
return n
})
nodePositionsChanged = nodePositionsChanged || hasChange
if (!hasChange) {
return
}
@@ -187,6 +190,8 @@ export function useDrag(params: UseDragParams) {
return
}
nodePositionsChanged = false
if (nodeDragThreshold.value === 0) {
startDrag(event, nodeEl)
}
@@ -244,7 +249,10 @@ export function useDrag(params: UseDragParams) {
}
if (dragItems.length && !isClick) {
if (nodePositionsChanged) {
updateNodePositions(dragItems, false, false)
nodePositionsChanged = false
}
const [currentNode, nodes] = getEventHandlerParams({
id,