mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 19:36:25 +08:00
Node: cache the label
Computing the path spec again and again is apparently very very expensive.
This commit is contained in:
@ -17,9 +17,14 @@ class Node {
|
|||||||
double forceX = 0.0;
|
double forceX = 0.0;
|
||||||
double forceY = 0.0;
|
double forceY = 0.0;
|
||||||
|
|
||||||
|
String _label;
|
||||||
|
|
||||||
Node(this.note);
|
Node(this.note);
|
||||||
|
|
||||||
String get label => note.pathSpec();
|
String get label {
|
||||||
|
_label ??= note.pathSpec();
|
||||||
|
return _label;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => "Node{$label, $x, $y}";
|
String toString() => "Node{$label, $x, $y}";
|
||||||
|
Reference in New Issue
Block a user