Show More
@@ -9,9 +9,10 define([ | |||
|
9 | 9 | var IntTextView = int_widgets.IntTextView; |
|
10 | 10 | |
|
11 | 11 | var FloatSliderView = IntSliderView.extend({ |
|
12 |
_parse_ |
|
|
12 | _parse_value: parseFloat, | |
|
13 | 13 | |
|
14 | _range_regex: /^\s*([+-]?\d*\.?\d+)\s*[-:]\s*([+-]?\d*\.?\d+)/, | |
|
14 | // matches: whitespace?, float, whitespace?, [-:], whitespace?, float | |
|
15 | _range_regex: /^\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)\s*[-:]\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)/, | |
|
15 | 16 | |
|
16 | 17 | _validate_slide_value: function(x) { |
|
17 | 18 | // Validate the value of the slider before sending it to the back-end |
@@ -21,10 +22,7 define([ | |||
|
21 | 22 | }); |
|
22 | 23 | |
|
23 | 24 | var FloatTextView = IntTextView.extend({ |
|
24 |
_parse_value: |
|
|
25 | // Parse the value stored in a string. | |
|
26 | return parseFloat(value); | |
|
27 | }, | |
|
25 | _parse_value: parseFloat | |
|
28 | 26 | }); |
|
29 | 27 | |
|
30 | 28 | return { |
@@ -188,8 +188,8 define([ | |||
|
188 | 188 | // ranges can be expressed either "val-val" or "val:val" (+spaces) |
|
189 | 189 | var match = this._range_regex.exec(text); |
|
190 | 190 | if (match) { |
|
191 |
var values = [this._parse_ |
|
|
192 |
this._parse_ |
|
|
191 | var values = [this._parse_value(match[1]), | |
|
192 | this._parse_value(match[2])]; | |
|
193 | 193 | // reject input where NaN or lower > upper |
|
194 | 194 | if (isNaN(values[0]) || |
|
195 | 195 | isNaN(values[1]) || |
@@ -214,7 +214,7 define([ | |||
|
214 | 214 | } |
|
215 | 215 | } else { |
|
216 | 216 | // single value case |
|
217 |
var value = this._parse_ |
|
|
217 | var value = this._parse_value(text); | |
|
218 | 218 | if (isNaN(value)) { |
|
219 | 219 | this.$readout.text(this.model.get('value')); |
|
220 | 220 | } else { |
@@ -231,7 +231,7 define([ | |||
|
231 | 231 | } |
|
232 | 232 | }, |
|
233 | 233 | |
|
234 |
_parse_ |
|
|
234 | _parse_value: parseInt, | |
|
235 | 235 | |
|
236 | 236 | _range_regex: /^\s*([+-]?\d+)\s*[-:]\s*([+-]?\d+)/, |
|
237 | 237 | |
@@ -362,10 +362,7 define([ | |||
|
362 | 362 | } |
|
363 | 363 | }, |
|
364 | 364 | |
|
365 |
_parse_value: |
|
|
366 | // Parse the value stored in a string. | |
|
367 | return parseInt(value); | |
|
368 | }, | |
|
365 | _parse_value: parseInt | |
|
369 | 366 | }); |
|
370 | 367 | |
|
371 | 368 |
General Comments 0
You need to be logged in to leave comments.
Login now