fix(editor): Snap tidy-up node positions to grid (#30455)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alexander Gekov
2026-05-18 10:17:44 +03:00
committed by GitHub
parent 4b0da31d55
commit e105063010
2 changed files with 12 additions and 8 deletions
@@ -135,7 +135,7 @@ exports[`useCanvasLayout > should layout a workflow with sticky notes 1`] = `
},
{
"id": "sticky",
"x": 134,
"x": 128,
"y": -240,
},
],
@@ -565,15 +565,19 @@ export function useCanvasLayout(canvasId: string, isEmbeddedNdvActive: ComputedR
})
.filter(isPresent);
const snapToGrid = (value: number) => Math.round(value / GRID_SIZE) * GRID_SIZE;
const finalNodes = positionedNodes.concat(positionedStickies).map(({ id, boundingBox }) => {
return {
id,
x: snapToGrid(boundingBox.x - anchor.x),
y: snapToGrid(boundingBox.y - anchor.y),
};
});
return {
boundingBox: boundingBoxAfter,
nodes: positionedNodes.concat(positionedStickies).map(({ id, boundingBox }) => {
return {
id,
x: boundingBox.x - anchor.x,
y: boundingBox.y - anchor.y,
};
}),
nodes: finalNodes,
};
}