From 3c70292e6ccb5263277219836bf0bef47cf36a51 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Thu, 8 Jun 2017 12:49:32 +0200 Subject: [PATCH] Fixed issue with selectable state of buttons --- src/js/includes/TextButton.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/js/includes/TextButton.js b/src/js/includes/TextButton.js index f1520de..8189390 100644 --- a/src/js/includes/TextButton.js +++ b/src/js/includes/TextButton.js @@ -80,8 +80,12 @@ function TextButton(id, text, settings) { this.onClick = function(callback) { _callback = callback || function() {}; this.on('mousedown', function (e) { - this.__active = !this.__active; - handleMouseDown.call(this, e); + // As inactive buttons are still clickable, we first check if the button is 'selectable'. + // Only then we should do stuff. + if (this.selectable) { + this.__active = !this.__active; + handleMouseDown.call(this, e); + } }.bind(this)); return this; };