Show More
@@ -1,30 +1,34 b'' | |||||
1 | // Copyright (c) IPython Development Team. |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Distributed under the terms of the Modified BSD License. |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 |
|
3 | |||
4 | define([ |
|
4 | define([ | |
5 | "widgets/js/widget", |
|
5 | "widgets/js/widget", | |
6 | "widgets/js/widget_int", |
|
6 | "widgets/js/widget_int", | |
7 | ], function(widget, int_widgets){ |
|
7 | ], function(widget, int_widgets){ | |
8 | var IntSliderView = int_widgets.IntSliderView; |
|
8 | var IntSliderView = int_widgets.IntSliderView; | |
9 | var IntTextView = int_widgets.IntTextView; |
|
9 | var IntTextView = int_widgets.IntTextView; | |
10 |
|
10 | |||
11 | var FloatSliderView = IntSliderView.extend({ |
|
11 | var FloatSliderView = IntSliderView.extend({ | |
|
12 | _validate_text_input: function(x) { | |||
|
13 | return parseFloat(x); | |||
|
14 | }, | |||
|
15 | ||||
12 | _validate_slide_value: function(x) { |
|
16 | _validate_slide_value: function(x) { | |
13 | // Validate the value of the slider before sending it to the back-end |
|
17 | // Validate the value of the slider before sending it to the back-end | |
14 | // and applying it to the other views on the page. |
|
18 | // and applying it to the other views on the page. | |
15 | return x; |
|
19 | return x; | |
16 | }, |
|
20 | }, | |
17 | }); |
|
21 | }); | |
18 |
|
22 | |||
19 | var FloatTextView = IntTextView.extend({ |
|
23 | var FloatTextView = IntTextView.extend({ | |
20 | _parse_value: function(value) { |
|
24 | _parse_value: function(value) { | |
21 | // Parse the value stored in a string. |
|
25 | // Parse the value stored in a string. | |
22 | return parseFloat(value); |
|
26 | return parseFloat(value); | |
23 | }, |
|
27 | }, | |
24 | }); |
|
28 | }); | |
25 |
|
29 | |||
26 | return { |
|
30 | return { | |
27 | 'FloatSliderView': FloatSliderView, |
|
31 | 'FloatSliderView': FloatSliderView, | |
28 | 'FloatTextView': FloatTextView, |
|
32 | 'FloatTextView': FloatTextView, | |
29 | }; |
|
33 | }; | |
30 | }); |
|
34 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now