aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/document-util.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-13 13:43:38 -0400
committerGitHub <noreply@github.com>2020-09-13 13:43:38 -0400
commitd7c3c87d992924e6fc4f21a3da95ab992c43d905 (patch)
tree6ae6a0c878bbf1ee39a16e81f732003fc0d21780 /ext/mixed/js/document-util.js
parent621aa354e77a5f0e7825ff0ad7a66c41154f2511 (diff)
Mouse button modifier update (#824)
* Ensure buttons is positive before adding to set * Break early when there are no flags remaining
Diffstat (limited to 'ext/mixed/js/document-util.js')
-rw-r--r--ext/mixed/js/document-util.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/mixed/js/document-util.js b/ext/mixed/js/document-util.js
index 58b0c759..d448fc3c 100644
--- a/ext/mixed/js/document-util.js
+++ b/ext/mixed/js/document-util.js
@@ -312,12 +312,14 @@ class DocumentUtil {
}
static _getActiveButtons(event, set) {
- const {buttons} = event;
- if (typeof buttons === 'number') {
+ let {buttons} = event;
+ if (typeof buttons === 'number' && buttons > 0) {
for (let i = 0; i < 6; ++i) {
const buttonFlag = (1 << i);
if ((buttons & buttonFlag) !== 0) {
set.add(`mouse${i}`);
+ buttons &= ~buttonFlag;
+ if (buttons === 0) { break; }
}
}
}