lexgui 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,13 @@ let Widget = LX.Widget;
23
23
 
24
24
  Panel.prototype.addKnob = function( name, value, min, max, callback, options = {} ) {
25
25
 
26
- let widget = this.create_widget( name, Widget.KNOB, options );
26
+ if( value.constructor == Number )
27
+ {
28
+ value = LX.clamp( value, min, max );
29
+ value = options.precision ? LX.round( value, options.precision ) : value;
30
+ }
31
+
32
+ let widget = this._createWidget( Widget.KNOB, name, value, options );
27
33
 
28
34
  widget.onGetValue = () => {
29
35
  return innerKnobCircle.value;
@@ -35,15 +41,6 @@ Panel.prototype.addKnob = function( name, value, min, max, callback, options = {
35
41
 
36
42
  let element = widget.domEl;
37
43
 
38
- // Add reset functionality
39
- if( widget.name ) {
40
- Panel._add_reset_property( element.domName, function() {
41
- this.style.display = "none";
42
- innerSetValue( innerKnobCircle.iValue );
43
- Panel._dispatch_event( innerKnobCircle, "change" );
44
- });
45
- }
46
-
47
44
  const snapEnabled = ( options.snap && options.snap.constructor == Number );
48
45
  const ticks = [];
49
46
  if( snapEnabled )
@@ -77,13 +74,6 @@ Panel.prototype.addKnob = function( name, value, min, max, callback, options = {
77
74
  let knobMarker = document.createElement( 'div' );
78
75
  knobMarker.className = "knobmarker";
79
76
  innerKnobCircle.appendChild( knobMarker );
80
-
81
- if( value.constructor == Number )
82
- {
83
- value = LX.clamp( value, min, max );
84
- value = options.precision ? LX.round( value, options.precision ) : value;
85
- }
86
-
87
77
  innerKnobCircle.value = innerKnobCircle.iValue = value;
88
78
 
89
79
  let mustSnap = false;
@@ -202,7 +192,8 @@ Panel.prototype.addKnob = function( name, value, min, max, callback, options = {
202
192
  element.appendChild( container );
203
193
 
204
194
  // Remove branch padding and margins
205
- if( !widget.name ) {
195
+ if( !widget.name )
196
+ {
206
197
  element.className += " noname";
207
198
  container.style.width = "100%";
208
199
  }