Commit c235a080c5ecf3c1c55d12fcb51c4fb19af9aabf

Authored by Benjamin Renard
2 parents aa1e1e6d 82ec8dd0
Exists in SpeasyGet

Merge branch 'amdadev' into SpeasyGet

js/app/views/PlotComponents/intervalSelection/IntervalSelection.js
... ... @@ -67,15 +67,22 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', {
67 67 if (newValue === null || newValue === undefined || newValue === '') return;
68 68 var field2 = self._getField2();
69 69 // Check if field2 is not empty
70   - const value2 = parseFloat(field2.getValue());
71   - if (value2 !== null && value2 !== undefined && value2 !== '') {
72   - if (parseFloat(newValue) > value2) {
73   - // Update both field1 and field2 to the new values
74   - field2.suspendEvents();
75   - field2.setValue(newValue);
76   - field.setValue(value2);
77   - field2.resumeEvents();
78   - }
  70 + const value2 = field2.getValue();
  71 + if (value2 === null || value2 === undefined || value2 === '') return;
  72 +
  73 + var value2Parsed = value2;
  74 + var newValueParsed = newValue;
  75 +
  76 + if (field.xtype == 'standardfloatfield') {
  77 + newValueParsed = parseFloat(newValueParsed);
  78 + value2Parsed = parseFloat(value2Parsed);
  79 + }
  80 + if (newValueParsed > value2Parsed) {
  81 + // Update both field1 and field2 to the new values
  82 + field2.suspendEvents();
  83 + field2.setValue(newValue);
  84 + field.setValue(value2);
  85 + field2.resumeEvents();
79 86 }
80 87 }
81 88 }
... ... @@ -90,15 +97,22 @@ Ext.define('amdaPlotComp.intervalSelection.IntervalSelection', {
90 97 if (newValue === null || newValue === undefined || newValue === '') return;
91 98 var field1 = self._getField1();
92 99 // Check if field1 is not empty
93   - const value1 = parseFloat(field1.getValue());
94   - if (value1 !== null && value1 !== undefined && value1 !== '') {
95   - if (parseFloat(newValue) < value1) {
96   - // Update both field1 and field2 to the new values
97   - field1.suspendEvents();
98   - field1.setValue(newValue);
99   - field.setValue(value1);
100   - field1.resumeEvents();
101   - }
  100 + const value1 = field1.getValue();
  101 + if (value1 === null || value1 === undefined || value1 === '') return;
  102 +
  103 + var value1Parsed = value1;
  104 + var newValueParsed = newValue;
  105 +
  106 + if (field.xtype == 'standardfloatfield') {
  107 + newValueParsed = parseFloat(newValue);
  108 + value1Parsed = parseFloat(value1Parsed);
  109 + }
  110 + if (newValueParsed < value1Parsed) {
  111 + // Update both field1 and field2 to the new values
  112 + field1.suspendEvents();
  113 + field1.setValue(newValue);
  114 + field.setValue(value1);
  115 + field1.resumeEvents();
102 116 }
103 117 }
104 118 }
... ...
js/app/views/PlotComponents/intervalSelection/ZoomIntervalSelection.js
... ... @@ -30,9 +30,14 @@ Ext.define(&#39;amdaPlotComp.intervalSelection.ZoomIntervalSelection&#39;, {
30 30 if (this._notValidValues()) {
31 31 myDesktopApp.warningMsg('The Input Values are not defined');
32 32 } else {
  33 + var minVal = this.getField1Value();
  34 + var maxVal = this.getField2Value();
33 35  
34   - var minVal = Ext.Date.format(this.getField1Value(), 'Y-m-d\\TH:i:s.u');
35   - var maxVal = Ext.Date.format(this.getField2Value(), 'Y-m-d\\TH:i:s.u');
  36 +
  37 + if (this.type == 'timeAxis') {
  38 + minVal = Ext.Date.format(minVal, 'Y-m-d\\TH:i:s.u');
  39 + maxVal = Ext.Date.format(maxVal, 'Y-m-d\\TH:i:s.u');
  40 + }
36 41  
37 42 this.hostCmp.callInteractivePlot({
38 43 'action': 'zoom',
... ...