From bfcc39df6cc703d5dd6fe33e1435e7160bad9c74 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 6 Sep 2020 23:31:51 -0400 Subject: [PATCH] TODO --- ext/mixed/js/document-util.js | 14 ++++++++++++++ ext/mixed/js/text-scanner.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ext/mixed/js/document-util.js b/ext/mixed/js/document-util.js index ba39942dd2..1ae62ce46b 100644 --- a/ext/mixed/js/document-util.js +++ b/ext/mixed/js/document-util.js @@ -188,6 +188,20 @@ class DocumentUtil { return modifiers; } + static getActiveModifiersAndButtons(event) { + const modifiers = this.getActiveModifiers(); + const {buttons} = event; + if (typeof buttons === 'number') { + for (let i = 0; i < 6; ++i) { + const buttonFlag = (1 << i); + if ((buttons & buttonFlag) !== 0) { + buttons.add(`mouse${i}`); + } + } + } + return modifiers; + } + static getKeyFromEvent(event) { const key = event.key; return (typeof key === 'string' ? (key.length === 1 ? key.toUpperCase() : key) : ''); diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js index 0e29558525..3f390cd4e2 100644 --- a/ext/mixed/js/text-scanner.js +++ b/ext/mixed/js/text-scanner.js @@ -229,7 +229,7 @@ class TextScanner extends EventDispatcher { return; } - const modifiers = DocumentUtil.getActiveModifiers(e); + const modifiers = DocumentUtil.getActiveModifiers(e); // getActiveModifiersAndButtons this.trigger('activeModifiersChanged', {modifiers}); if (!(