Skip to content

Commit

Permalink
TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
toasted-nutbread committed Sep 7, 2020
1 parent 7a59ca2 commit bfcc39d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions ext/mixed/js/document-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) : '');
Expand Down
2 changes: 1 addition & 1 deletion ext/mixed/js/text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!(
Expand Down

0 comments on commit bfcc39d

Please sign in to comment.