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 };
|
let nextPosition = { x: x - dragItem.distance.x, y: y - dragItem.distance.y };
|
||||||
|
|
||||||
if (snapToGrid) {
|
if (snapToGrid) {
|
||||||
nextPosition = multiDragSnapOffset
|
nextPosition = multiDragSnapOffset
|
||||||
? {
|
? {
|
||||||
x: nextPosition.x + multiDragSnapOffset.x,
|
x: Math.round(nextPosition.x + multiDragSnapOffset.x),
|
||||||
y: nextPosition.y + multiDragSnapOffset.y,
|
y: Math.round(nextPosition.y + multiDragSnapOffset.y),
|
||||||
}
|
}
|
||||||
: snapPosition(nextPosition, snapGrid);
|
: snapPosition(nextPosition, snapGrid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user