input.js: fix button index on mouse events

The buttonMask variable was useless and using it as the button index
in the navigation events was nonsensical.

In addition, the button index must be increased by one to map it to
the X domain.
This commit is contained in:
Mathieu Duponchelle 2022-06-02 23:46:38 +02:00
parent 42f2ae7c2b
commit 3beb712e16

View file

@ -49,11 +49,6 @@ class Input {
*/
this.m = null;
/**
* @type {Integer}
*/
this.buttonMask = 0;
/**
* @type {Keyboard}
*/
@ -155,14 +150,7 @@ class Input {
}
if (event.type === 'mousedown' || event.type === 'mouseup') {
var mask = 1 << event.button;
if (down) {
this.buttonMask |= mask;
} else {
this.buttonMask &= ~mask;
}
data["button"] = this.buttonMask;
data["button"] = event.button + 1;
}
data["x"] = this.x;