diff --git a/src/systems/userinput/bindings/keyboard-mouse-user.js b/src/systems/userinput/bindings/keyboard-mouse-user.js index 0305d80fb17305127c286cf8a79b924389af6900..49b3df5326759c3a7b75e05a0ac6146918480ebe 100644 --- a/src/systems/userinput/bindings/keyboard-mouse-user.js +++ b/src/systems/userinput/bindings/keyboard-mouse-user.js @@ -109,7 +109,7 @@ export const keyboardMouseUserBindings = { { src: { value: "/var/smartMouseCamDeltaX" }, dest: { value: "/var/smartMouseCamDeltaXScaled" }, - xform: xforms.scale(-0.06) + xform: xforms.scale(-0.16) }, { src: { value: "/var/smartMouseCamDeltaY" }, diff --git a/src/systems/userinput/devices/mouse.js b/src/systems/userinput/devices/mouse.js index 7ade933976a29741271e6e6922acb0a620ac9756..3252fb7372a53406da0992b8b3445a9f854dd065 100644 --- a/src/systems/userinput/devices/mouse.js +++ b/src/systems/userinput/devices/mouse.js @@ -18,8 +18,8 @@ export class MouseDevice { const queueEvent = this.events.push.bind(this.events); const canvas = document.querySelector("canvas"); - ["mousedown", "mouseup", "mousemove", "wheel"].map(x => canvas.addEventListener(x, queueEvent)); - ["mouseout", "blur"].map(x => document.addEventListener(x, queueEvent)); + ["mousedown", "wheel"].map(x => canvas.addEventListener(x, queueEvent)); + ["mousemove", "mouseup"].map(x => window.addEventListener(x, queueEvent)); document.addEventListener("wheel", e => { e.preventDefault(); }); @@ -30,13 +30,7 @@ export class MouseDevice { this.wheel += (event.deltaX + event.deltaY) / modeMod[event.deltaMode]; return; } - if (event.type === "mouseout" || event.type === "blur") { - this.coords[0] = 0; - this.coords[1] = 0; - this.movementXY[0] = 0; - this.movementXY[1] = 0; - this.wheel = 0; - } + const left = event.button === 0; const right = event.button === 2; this.coords[0] = (event.clientX / window.innerWidth) * 2 - 1;