diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts index 814db2e708fde90832361c51d496bf8a6c0531c2..5a6504ec0fec809ea3d8bb2bb6ade6862d9af50a 100644 --- a/src/app/formulaire/definition/form-definition.ts +++ b/src/app/formulaire/definition/form-definition.ts @@ -10,7 +10,8 @@ import { ParamDefinition, Result, VariatedDetails, - Prop_NullParameters + Prop_NullParameters, + SessionSettings } from "jalhyd"; import { FormulaireElement } from "../elements/formulaire-element"; @@ -67,6 +68,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs constructor(parent?: FormulaireNode) { super(parent); + SessionSettings.instance.addObserver(this); } // surcharge de FormulaireNode::get:uid() @@ -421,6 +423,10 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs break; } } + else if (sender instanceof SessionSettings) { + // reset results if a session setting (max iterations, compute precision) has been modified + this.reset(); + } } /** diff --git a/src/app/services/app-setup.service.ts b/src/app/services/app-setup.service.ts index 16e3cf00e4398bf9815fa5a6194310b0b871cb4f..1bc7712275f5247237b133477ebcd75b5c5f2445 100644 --- a/src/app/services/app-setup.service.ts +++ b/src/app/services/app-setup.service.ts @@ -20,31 +20,27 @@ export class ApplicationSetupService extends Observable { // default builtin values public displayPrecision = 3; - private _computePrecision = 1e-7; // tied to model - private _maxIterations = 100; // tied to model + private static readonly _defaultComputePrecision = 1e-7; // tied to model + private static readonly _defaultMaxIterations = 100; // tied to model public enableNotifications = true; public enableHotkeys = false; private _enableEmptyFieldsOnFormInit = true; private _foldedMessageLog = false; public set computePrecision(p: number) { - this._computePrecision = p; - // forward to model SessionSettings.precision = p; } public get computePrecision(): number { - return this._computePrecision; + return SessionSettings.precision; } public set maxIterations(m: number) { - this._maxIterations = m; - // forward to model SessionSettings.maxIterations = m; } public get maxIterations(): number { - return this._maxIterations; + return SessionSettings.maxIterations; } public get enableEmptyFieldsOnFormInit() {