Commit f26d31e3 authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

Fix resetDefaultCalculatedParam for parallel structures

Showing with 27 additions and 5 deletions
+27 -5
...@@ -124,6 +124,7 @@ export abstract class Nub extends ComputeNode implements IObservable { ...@@ -124,6 +124,7 @@ export abstract class Nub extends ComputeNode implements IObservable {
if ( if (
p.calculability !== ParamCalculability.NONE p.calculability !== ParamCalculability.NONE
&& p.symbol !== "Pr" && p.symbol !== "Pr"
&& p.visible
&& p !== otherThan && p !== otherThan
&& p.valueMode === ParamValueMode.SINGLE && p.valueMode === ParamValueMode.SINGLE
) { ) {
......
...@@ -310,9 +310,8 @@ export class ParamDefinition implements INamedIterableValues, IObservable { ...@@ -310,9 +310,8 @@ export class ParamDefinition implements INamedIterableValues, IObservable {
* its parent Nub * its parent Nub
*/ */
public get isCalculated(): boolean { public get isCalculated(): boolean {
if (this.parentComputeNode && this.parentComputeNode instanceof Nub) { if (this.parentNub) {
// return (this.parentComputeNode.calculatedParam.symbol === this.symbol); return (this.parentNub.calculatedParam === this); // should be the same object
return (this.parentComputeNode.calculatedParam === this); // should be the same object
} }
return false; return false;
} }
...@@ -321,8 +320,8 @@ export class ParamDefinition implements INamedIterableValues, IObservable { ...@@ -321,8 +320,8 @@ export class ParamDefinition implements INamedIterableValues, IObservable {
* Sets this parameter as the one to be calculated * Sets this parameter as the one to be calculated
*/ */
public setCalculated() { public setCalculated() {
if (this.parentComputeNode && this.parentComputeNode instanceof Nub) { if (this.parentNub) {
this.parentComputeNode.calculatedParam = this; this.parentNub.calculatedParam = this;
} }
} }
......
...@@ -97,6 +97,17 @@ export abstract class Structure extends Nub { ...@@ -97,6 +97,17 @@ export abstract class Structure extends Nub {
} }
} }
/**
* Forwards to parent, that has vsibility over
* all the parameters, including the Structure ones
*/
public get calculatedParam(): ParamDefinition {
if (this.parent) {
return this.parent.calculatedParam;
}
return undefined;
}
/** /**
* Forwards to parent, that has vsibility over * Forwards to parent, that has vsibility over
* all the parameters, including the Structure ones * all the parameters, including the Structure ones
...@@ -107,6 +118,17 @@ export abstract class Structure extends Nub { ...@@ -107,6 +118,17 @@ export abstract class Structure extends Nub {
} }
} }
/**
* Forwards to parent, that has vsibility over
* all the parameters, including the Structure ones
*/
public findFirstSingleParameter(otherThan?: ParamDefinition) {
if (this.parent) {
return this.parent.findFirstSingleParameter(otherThan);
}
return undefined;
}
/** /**
* Forwards to parent, that has visibility over * Forwards to parent, that has visibility over
* all the parameters, including the Structure ones * all the parameters, including the Structure ones
......
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