GUI2 Fixed bug of edge link not being added dynamically
Change-Id: If5a2b546f23274bbdac09a55bdd18357c72414fe
diff --git a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/layer/forcesvg/visuals/linksvg/linksvg.component.ts b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/layer/forcesvg/visuals/linksvg/linksvg.component.ts
index 85ef536..c669c1c 100644
--- a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/layer/forcesvg/visuals/linksvg/linksvg.component.ts
+++ b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/layer/forcesvg/visuals/linksvg/linksvg.component.ts
@@ -57,6 +57,7 @@
enhanced: boolean = false;
labelPosSrc: Point = {x: 0, y: 0};
labelPosTgt: Point = {x: 0, y: 0};
+ lastTimer: any;
constructor(
protected log: LogService,
@@ -68,16 +69,17 @@
ngOnChanges(changes: SimpleChanges) {
if (changes['linkHighlight']) {
const hl: LinkHighlight = changes['linkHighlight'].currentValue;
+ clearTimeout(this.lastTimer);
this.highlighted = hl.css;
this.label = hl.label;
this.isHighlighted = true;
- this.log.debug('Link hightlighted', hl);
+ this.log.debug('Link hightlighted', this.link.id, this.highlighted);
if (hl.fadems > 0) {
- setTimeout(() => {
+ this.lastTimer = setTimeout(() => {
this.isHighlighted = false;
this.highlighted = '';
this.ref.markForCheck();
- }, hl.fadems);
+ }, hl.fadems); // Disappear slightly before next one comes in
}
}