Mouse button modifier update (#824)
* Ensure buttons is positive before adding to set * Break early when there are no flags remaining
This commit is contained in:
parent
621aa354e7
commit
d7c3c87d99
@ -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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user