Merge pull request #5466 from xyflow/fix/multiselect-floating

Fix/multiselect floating
This commit is contained in:
Moritz Klack
2025-08-19 10:15:41 +02:00
committed by GitHub
2 changed files with 7 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@xyflow/system': patch
---
Round floating numbers for node positions when dragging a multi selection
+2 -3
View File
@@ -154,12 +154,11 @@ export function XYDrag<OnNodeDrag extends (e: any, nodes: any, node: any) => voi
}
let nextPosition = { x: x - dragItem.distance.x, y: y - dragItem.distance.y };
if (snapToGrid) {
nextPosition = multiDragSnapOffset
? {
x: nextPosition.x + multiDragSnapOffset.x,
y: nextPosition.y + multiDragSnapOffset.y,
x: Math.round(nextPosition.x + multiDragSnapOffset.x),
y: Math.round(nextPosition.y + multiDragSnapOffset.y),
}
: snapPosition(nextPosition, snapGrid);
}