@@ -21,8 +21,6 @@ const SUPPORTED_CONVERSIONS = {
21
21
const supportedConversionFromUnit = ( unit ) =>
22
22
unit ? SUPPORTED_CONVERSIONS [ convert ( ) . describe ( unit ) . measure ] : [ ] ;
23
23
24
- const round = ( x ) => Math . round ( x * 100 ) / 100 ;
25
-
26
24
const RangeLabel = ( {
27
25
background = 'none' ,
28
26
children,
@@ -119,7 +117,6 @@ class RangeAgg extends Component {
119
117
stats : { max, min } ,
120
118
} = this . props ;
121
119
let { currentValues, displayUnit } = this . state ;
122
- const [ currentMax , currentMin ] = [ currentValues . max , currentValues . min ] . map ( ( x ) => round ( x ) ) ;
123
120
124
121
return handleChange ?. ( {
125
122
field : {
@@ -133,18 +130,18 @@ class RangeAgg extends Component {
133
130
{
134
131
op : 'and' ,
135
132
content : [
136
- ...( currentMin > min
137
- ? [ { op : '>=' , content : { fieldName, value : currentMin } } ]
133
+ ...( currentValues . min > min
134
+ ? [ { op : '>=' , content : { fieldName, value : currentValues . min } } ]
138
135
: [ ] ) ,
139
- ...( currentMax < max
140
- ? [ { op : '<=' , content : { fieldName, value : currentMax } } ]
136
+ ...( currentValues . max < max
137
+ ? [ { op : '<=' , content : { fieldName, value : currentValues . max } } ]
141
138
: [ ] ) ,
142
139
] ,
143
140
} ,
144
141
sqon ,
145
142
) ,
146
- max : currentMax ,
147
- min : currentMin ,
143
+ max : currentValues . max ,
144
+ min : currentValues . min ,
148
145
value : currentValues ,
149
146
} ) ;
150
147
} ;
@@ -156,8 +153,8 @@ class RangeAgg extends Component {
156
153
stats : { max, min } ,
157
154
} = this . props ;
158
155
159
- if ( round ( newMax ) <= round ( max ) && round ( newMin ) >= round ( min ) ) {
160
- this . setState ( { currentValues : { max : round ( newMax ) , min : round ( newMin ) } } ) ;
156
+ if ( newMax <= max && newMin >= min ) {
157
+ this . setState ( { currentValues : { max : newMax , min : newMin } } ) ;
161
158
} else {
162
159
console . error ( 'the selected value is out of range' ) ;
163
160
}
0 commit comments