Skip to content
Snippets Groups Projects
Commit 43ac184a authored by Mathias Chouet's avatar Mathias Chouet
Browse files

PreBarrage: move walls

parent 696e0c11
No related branches found
No related tags found
1 merge request!96WIP: Resolve "Simplifier les composants de résultats"
......@@ -80,7 +80,7 @@ export class SelectModelFieldLineComponent implements OnInit {
public async createModel() {
const f = await this._formService.createFormulaire(this._select.calcType);
this.router.navigate(["/calculator", f.uid]);
// on ajoute un ouvrage aux modulex de type "parallèle"
// on ajoute un ouvrage aux modules de type "parallèle"
for (const e of f.allFormElements) {
if (e instanceof FieldsetContainer) {
e.addFromTemplate(0);
......
......@@ -272,7 +272,6 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
break;
case "template_container":
console.log("parsing template container !", conf);
this.parse_template_container(conf, templates);
break;
......
......@@ -17,26 +17,18 @@ export class FormulairePbCloison extends FormulaireParallelStructure {
this._downstreamBasinSelectId = this.getOption(json, "downstreamBasinSelectId");
}
protected completeParse(json: {}, firstNotif: boolean = true) {
protected completeParse(json: {}) {
super.completeParse(json);
if (this._upstreamBasinSelectId) {
const sel = this.getFormulaireNodeById(this._upstreamBasinSelectId);
if (sel) {
sel.addObserver(this);
if (firstNotif) {
// force 1st observation
(sel as SelectFieldNub).notifySelectValueChanged();
}
}
}
if (this._downstreamBasinSelectId) {
const sel = this.getFormulaireNodeById(this._downstreamBasinSelectId);
if (sel) {
sel.addObserver(this);
if (firstNotif) {
// force 1st observation
(sel as SelectFieldNub).notifySelectValueChanged();
}
}
}
}
......@@ -64,13 +56,23 @@ export class FormulairePbCloison extends FormulaireParallelStructure {
// empty "" data.value.value should return undefined, which is good for amont/aval
const newBasin = pb.findChild(data.value.value) as PbBassin;
if (sender.id === this._upstreamBasinSelectId) {
nub.bassinAmont = newBasin;
// remove and recreate wall (easier for pointers consistency)
const oldDownstreamBasin = nub.bassinAval;
pb.deleteChild(pb.findChildPosition(nub.uid));
const newWall = new PbCloison(newBasin, oldDownstreamBasin);
pb.addChild(newWall);
this.currentNub = newWall;
} else if (sender.id === this._downstreamBasinSelectId) {
nub.bassinAval = newBasin;
// remove and recreate wall (easier for pointers consistency)
const oldUpstreamBasin = nub.bassinAmont;
pb.deleteChild(pb.findChildPosition(nub.uid));
const newWall = new PbCloison(oldUpstreamBasin, newBasin);
pb.addChild(newWall);
this.currentNub = newWall;
}
this.notifyObservers({
action: "updateBasin",
value: nub.uid // node to select on the schema
value: this._currentNub.uid // node to select on the schema
}, this);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment