Fixed issue with selectable state of buttons

This commit is contained in:
Erik Tiekstra
2017-06-08 12:49:32 +02:00
parent dd2c965178
commit 3c70292e6c
+6 -2
View File
@@ -80,8 +80,12 @@ function TextButton(id, text, settings) {
this.onClick = function(callback) { this.onClick = function(callback) {
_callback = callback || function() {}; _callback = callback || function() {};
this.on('mousedown', function (e) { this.on('mousedown', function (e) {
this.__active = !this.__active; // As inactive buttons are still clickable, we first check if the button is 'selectable'.
handleMouseDown.call(this, e); // Only then we should do stuff.
if (this.selectable) {
this.__active = !this.__active;
handleMouseDown.call(this, e);
}
}.bind(this)); }.bind(this));
return this; return this;
}; };