diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-11-08 22:19:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-08 22:19:54 -0500 |
commit | 8edb478d0adbc7c09e827f1606f9e7a6660dec65 (patch) | |
tree | d7776da1117456d94b2ef8861150637eca60143d /ext/mixed/js/display.js | |
parent | 681065e5549e3f6bf54e416120884481bded5b6e (diff) |
Update keyboard/mouse modifiers to return an array rather than a set (#1015)
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 39bd7732..9824c25e 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -205,7 +205,7 @@ class Display extends EventDispatcher { const eventModifiers = DocumentUtil.getActiveModifiers(e); for (const {modifiers, action} of handlers) { - if (getSetDifference(modifiers, eventModifiers).size !== 0) { continue; } + if (!this._areSame(modifiers, eventModifiers)) { continue; } const actionHandler = this._actions.get(action); if (typeof actionHandler === 'undefined') { continue; } @@ -1476,4 +1476,14 @@ class Display extends EventDispatcher { const {expression, reading} = termDetailsList[Math.max(0, bestIndex)]; return {expression, reading}; } + + _areSame(set, array) { + if (set.size !== array.size) { return false; } + for (const value of array) { + if (!set.has(value)) { + return false; + } + } + return true; + } } |