mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
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:
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user