Merge pull request #5466 from xyflow/fix/multiselect-floating
Fix/multiselect floating
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@xyflow/system': patch
|
||||
---
|
||||
|
||||
Round floating numbers for node positions when dragging a multi selection
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user