js/controls/button/button.js in rsence-2.1.11 vs js/controls/button/button.js in rsence-2.2.0

- old
+ new

@@ -46,32 +46,37 @@ defaultEvents: { click: true }, + controlDefaults: HControlDefaults.extend({ + clickOnValue: 1, + clickOffValue: 0 + }), + /** = Description * Sets the button enabled if this.value is 0. * **/ refreshValue: function(){ if( this.options.inverseValue ){ - this.setEnabled( this.value === 1 ); + this.setEnabled( this.value === this.options.clickOnValue ); } else { - this.setEnabled( this.value === 0 ); + this.setEnabled( this.value === this.options.clickOffValue ); } }, /** = Description * Click method, sets the value to disabled if the button is enabled. * **/ click: function(){ if(this.enabled){ if( this.options.inverseValue ){ - this.setValue(0); + this.setValue( this.options.clickOffValue ); } else { - this.setValue(1); + this.setValue( this.options.clickOnValue ); } } } });