Commit 438653f2 authored by Grand Francois's avatar Grand Francois
Browse files

fix: pre-dams: select upstream basin on calculator initialisation

refs #500 #560
Showing with 21 additions and 0 deletions
+21 -0
......@@ -124,6 +124,12 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni
this.selectNodeOnSchema(this._selectedItem);
}, 20); // timeout has to be greater than the 10ms of ngAfterViewInit()
}
else {
// select upstream basin since it's form is already displayed (and not undisplayable...)
setTimeout(() => {
this.selectUpstreamBasin();
}, 20); // timeout has to be greater than the 10ms of ngAfterViewInit()
}
}
private render() {
......@@ -421,6 +427,21 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni
});
}
/**
* select upstream basin on schema
*/
private selectUpstreamBasin() {
let done = false; // optimisation : simulate break in forEach
this.nativeElement.querySelectorAll("g.node").forEach(item => {
if (!done) {
if (MermaidUtil.isMermaidId("amont", item.id)) {
this.selectNode(item);
done = true;
}
}
});
}
// at this time @Input data is supposed to be already populated
public ngOnInit() {
this.model = this.pbSchema.pb;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment