From 6e6a2bf5b3382d2e77ec15e19a3fd974cd22ae19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= <francois.grand@irstea.fr> Date: Fri, 19 Jan 2018 07:08:48 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20d'un=20bug=20d'initialisation=20du?= =?UTF-8?q?=20min/max=20pour=20les=20param=C3=A8tres=20=C3=A0=20varier=20p?= =?UTF-8?q?ar=20ex=20:=20conduite=20distributrice,=20calculer=20Perte=20de?= =?UTF-8?q?=20charge,=20varier=20Longueur=20du=20tuyau,=20"calculer"=20->?= =?UTF-8?q?=20pas=20de=20graphe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../param-values/param-values.component.ts | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/app/components/param-values/param-values.component.ts b/src/app/components/param-values/param-values.component.ts index 0349075f1..e0f63c158 100644 --- a/src/app/components/param-values/param-values.component.ts +++ b/src/app/components/param-values/param-values.component.ts @@ -158,28 +158,7 @@ export class ParamValuesComponent implements DoCheck { this._valueModes.push({ "value": ParamValueMode.MINMAX, "label": "Min/max" }); this._valueModes.push({ "value": ParamValueMode.LISTE, "label": "Liste" }); } - - private getDefaultMin(): number { - switch (this._param.domain.domain) { - case ParamDomainValue.ANY: - case ParamDomainValue.NOT_NULL: - return -10; - - default: - return this._param.domain.minValue; - } - } - - private getDefaultMax(): number { - switch (this._param.domain.domain) { - case ParamDomainValue.INTERVAL: - return this._param.domain.maxValue; - - default: - return 10; - } - } - + private initMinMaxStep() { // valeur pour min (celle déjà définie ou celle déduite du domaine de définition) let min: number = this._param.minValue; @@ -195,7 +174,7 @@ export class ParamValuesComponent implements DoCheck { } } if (!ok) - min = this.getDefaultMin(); + min = this._param.getValue() / 2; // valeur pour max (celle déjà définie ou celle déduite du domaine de définition) let max: number = this._param.maxValue; @@ -211,13 +190,13 @@ export class ParamValuesComponent implements DoCheck { } } if (!ok) - max = this.getDefaultMax(); + max = this._param.getValue() * 2; this._minComponent.refValue = new Pair(this._param.domain.minValue, max); - this._minComponent.model = this._param.getValue() / 2; + this._minComponent.model = min; this._maxComponent.refValue = new Pair(min, this._param.domain.maxValue); - this._maxComponent.model = this._param.getValue() * 2; + this._maxComponent.model = max; this.updateStepComponentRef(); -- GitLab