From b34395f75481bc088b37d913d3ae09398db4c7fa Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Sat, 26 Sep 2020 06:03:14 +0200 Subject: [PATCH] Graph: Do not let nodes get stuck Nodes which have a pos < 0, are no longer force directed. This make the graph behave strangely. It's better to just push it a little further from the edge. --- lib/core/graph.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/core/graph.dart b/lib/core/graph.dart index 074eef72..907adc1f 100644 --- a/lib/core/graph.dart +++ b/lib/core/graph.dart @@ -328,9 +328,11 @@ bool _updateGraphPositions(Graph g) { // print('${node.label} $dx $dy'); if (node.x - dx <= g.nodeSize / 2) { + node.x = (g.nodeSize / 2) + 1; continue; } if (node.y - dy <= g.nodeSize / 2) { + node.y = (g.nodeSize / 2) + 1; continue; }