aboutsummaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/frontend.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 84d6af28..b9410f2c 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -497,19 +497,21 @@ class Frontend {
}
static isMouseButton(button, mouseEvent) {
- if (['mouseup', 'mousedown', 'click'].includes(mouseEvent.type)) {
- switch (button) {
+ switch (mouseEvent.type) {
+ case 'mouseup':
+ case 'mousedown':
+ case 'click': switch (button) {
case 'primary': return mouseEvent.button === 0;
case 'secondary': return mouseEvent.button === 2;
case 'auxiliary': return mouseEvent.button === 1;
default: return false;
}
- }
- switch (button) {
- case 'primary': return (mouseEvent.buttons & 0x1) !== 0x0;
- case 'secondary': return (mouseEvent.buttons & 0x2) !== 0x0;
- case 'auxiliary': return (mouseEvent.buttons & 0x4) !== 0x0;
- default: return false;
+ default: switch (button) {
+ case 'primary': return (mouseEvent.buttons & 0x1) !== 0x0;
+ case 'secondary': return (mouseEvent.buttons & 0x2) !== 0x0;
+ case 'auxiliary': return (mouseEvent.buttons & 0x4) !== 0x0;
+ default: return false;
+ }
}
}
}