From 1f434c1ef11fa55bab1718ea4e3ca8d115c0dfb1 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 8 Dec 2018 02:37:15 -0400 Subject: Mouse support Not exactly the most elegant implementation, but it definitely works and isn't really difficult to code around! --- ui/form/Button.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ui/form/Button.js') diff --git a/ui/form/Button.js b/ui/form/Button.js index 3a35912..46329a6 100644 --- a/ui/form/Button.js +++ b/ui/form/Button.js @@ -38,4 +38,14 @@ module.exports = class Button extends FocusElement { this.emit('pressed') } } + + clicked(button) { + if (button === 'left') { + if (this.isSelected) { + this.emit('pressed') + } else { + this.root.select(this) + } + } + } } -- cgit 1.3.0-6-gf8a5