Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50659 views
1
//----------------------------------------------------------------------------
2
// Copyright (C) 2013 The IPython Development Team
3
//
4
// Distributed under the terms of the BSD License. The full license is in
5
// the file COPYING, distributed as part of this software.
6
//----------------------------------------------------------------------------
7
8
//============================================================================
9
// FloatWidget
10
//============================================================================
11
12
/**
13
* @module IPython
14
* @namespace IPython
15
**/
16
17
define(["widgets/js/widget",
18
"widgets/js/widget_int"],
19
function(WidgetManager, int_widgets){
20
21
var IntSliderView = int_widgets[0];
22
var IntTextView = int_widgets[1];
23
24
25
var FloatSliderView = IntSliderView.extend({
26
_validate_slide_value: function(x) {
27
// Validate the value of the slider before sending it to the back-end
28
// and applying it to the other views on the page.
29
return x;
30
},
31
});
32
WidgetManager.register_widget_view('FloatSliderView', FloatSliderView);
33
34
35
var FloatTextView = IntTextView.extend({
36
_parse_value: function(value) {
37
// Parse the value stored in a string.
38
return parseFloat(value);
39
},
40
});
41
WidgetManager.register_widget_view('FloatTextView', FloatTextView);
42
});
43
44