Skip to content

Commit

Permalink
fix(setToolMode.js): Do not allow duplicates in the mouseButtonMask a…
Browse files Browse the repository at this point in the history
…rray on a tool

Fixes a bug where the app can have poor performance or even crash when setToolModeForElement is
called too many times.

#898
  • Loading branch information
mikehazell committed Mar 25, 2019
1 parent f64b8da commit 250ec17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/store/setToolMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ function setToolModeForElement(mode, changeEvent, element, toolName, options) {
options.mouseButtonMask.length !== 0 &&
Array.isArray(tool.options.mouseButtonMask)
) {
options.mouseButtonMask = options.mouseButtonMask.concat(
tool.options.mouseButtonMask
options.mouseButtonMask = Array.from(
new Set(options.mouseButtonMask.concat(tool.options.mouseButtonMask))
);
}

Expand Down

0 comments on commit 250ec17

Please sign in to comment.