From 941193ac43264bc4670097241809250906a4ec2e Mon Sep 17 00:00:00 2001 From: rashidakanchwala Date: Tue, 15 Oct 2024 17:06:40 +0100 Subject: [PATCH] fix some crossing issues --- src/utils/graph/layout.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/graph/layout.js b/src/utils/graph/layout.js index a74ab5750..f88a0af19 100644 --- a/src/utils/graph/layout.js +++ b/src/utils/graph/layout.js @@ -1,4 +1,4 @@ -import { HALF_PI, snap, angle, groupByRow } from './common'; +import { HALF_PI, snap, angle, compare, groupByRow } from './common'; import { solveLoose, solveStrict } from './solver'; import { rowConstraint, @@ -245,6 +245,8 @@ const createSeparationConstraints = (rows, constants) => { // For each row of nodes for (let i = 0; i < rows.length; i += 1) { const rowNodes = rows[i]; + + rowNodes.sort((a, b) => compare(a.x, b.x, a.id, b.id)); // Update constraints for the sorted row node order for (let j = 0; j < rowNodes.length-1; j += 1) {