widget_float.js
42 lines
| 1.4 KiB
| application/javascript
|
JavascriptLexer
Jonathan Frederic
|
r14366 | //---------------------------------------------------------------------------- | ||
// Copyright (C) 2013 The IPython Development Team | ||||
// | ||||
// Distributed under the terms of the BSD License. The full license is in | ||||
// the file COPYING, distributed as part of this software. | ||||
//---------------------------------------------------------------------------- | ||||
Jonathan Frederic
|
r14672 | //============================================================================ | ||
// FloatWidget | ||||
//============================================================================ | ||||
/** | ||||
* @module IPython | ||||
* @namespace IPython | ||||
**/ | ||||
Jonathan Frederic
|
r15427 | define(["widgets/js/widget", | ||
"widgets/js/widget_int"], | ||||
Jonathan Frederic
|
r14694 | function(WidgetManager, int_widgets){ | ||
Jonathan Frederic
|
r14672 | |||
Jonathan Frederic
|
r14694 | var IntSliderView = int_widgets[0]; | ||
var IntTextView = int_widgets[1]; | ||||
Jonathan Frederic
|
r14672 | |||
Jonathan Frederic
|
r14694 | var FloatSliderView = IntSliderView.extend({ | ||
_validate_slide_value: function(x) { | ||||
// Validate the value of the slider before sending it to the back-end | ||||
// and applying it to the other views on the page. | ||||
return x; | ||||
Jonathan Frederic
|
r14672 | }, | ||
}); | ||||
WidgetManager.register_widget_view('FloatSliderView', FloatSliderView); | ||||
MinRK
|
r14792 | var FloatTextView = IntTextView.extend({ | ||
Jonathan Frederic
|
r14694 | _parse_value: function(value) { | ||
// Parse the value stored in a string. | ||||
return parseFloat(value); | ||||
Jonathan Frederic
|
r14672 | }, | ||
}); | ||||
WidgetManager.register_widget_view('FloatTextView', FloatTextView); | ||||
}); | ||||