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.
This commit is contained in:
Vishesh Handa
2020-09-26 06:03:14 +02:00
parent 1b1e49902b
commit b34395f754

View File

@ -328,9 +328,11 @@ bool _updateGraphPositions(Graph g) {
// print('${node.label} $dx $dy'); // print('${node.label} $dx $dy');
if (node.x - dx <= g.nodeSize / 2) { if (node.x - dx <= g.nodeSize / 2) {
node.x = (g.nodeSize / 2) + 1;
continue; continue;
} }
if (node.y - dy <= g.nodeSize / 2) { if (node.y - dy <= g.nodeSize / 2) {
node.y = (g.nodeSize / 2) + 1;
continue; continue;
} }