-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed mouse button to object #7404
Conversation
I think it makes more sense for if (this._activeTouches.size === 0) {
Object.keys(this.mouseButton).forEach((key) => (this.mouseButton[key] = false));
} This approach means we treat all active touches on the screen as left touches, correct? In that case, right and center clicks would only be supported by a mouse if I'm not wrong. @davepagurek |
I think this is fine if it ends up being required. Although it looks like on MDN, If we keep track of the buttons for each active touch in a similar way to how you currently do the global const pointer = this.activePointers[e.pointerId]
pointer.mouseButton.left = (e.buttons & 1) !== 0;
pointer.mouseButton.center = (e.buttons & 4) !== 0;
pointer.mouseButton.right = (e.buttons & 2) !== 0;
for (const key in this.mouseButton) {
this.mouseButton[key] = Object.values(this.activePointers).some((p) => p.mouseButton[key])
} |
0d19067
to
6f70ec1
Compare
@davepagurek This now uses |
6f70ec1
to
79d66c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, just one minor comment about the reference!
@diyaayay @davepagurek Can we merge this now? |
I think we're good to go! |
Resolves #6847
Changes:
mouseButton
from a string to object.mouseButton
now intends to track the current state of mouse buttons, showing which buttons are pressed at any given moment.This work is done over the PR #7378
PR Checklist
npm run lint
passes