Skip to content
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

Proper mouse multi-button workarounds #803

Open
jonathanolson opened this issue May 25, 2018 · 5 comments
Open

Proper mouse multi-button workarounds #803

jonathanolson opened this issue May 25, 2018 · 5 comments

Comments

@jonathanolson
Copy link
Contributor

So phetsims/resistance-in-a-wire#147 brings up an interesting case where we can actually NOT receive a pointerup event for a pointerdown when pressing left/right mouse buttons (probably due to the context menu).

We CAN get the lostpointercapture event (which also triggers after usual ups). So we could theoretically:

  • When we get lostpointercapture while it's a touch/pen, cancel it.
  • When we get lostpointercapture while it's a mouse, do mouseup for the pressed buttons (has complications)
  • When we get a mouse up, do NOT fire the event if we got the lostpointercapture earlier (i.e. it's recorded as up on the Mouse object)

Besides being likely to break things:

  • We can't just call mouseUp(), since we need to control the mouse button than we're forcing up. That's stored on the PointerEvent, so we'd need to factor that out.
  • We'd need to call it for potentially multiple buttons (say the left and right buttons were down at the same time, as in the example from the linked issue).
  • We'd need to consider passing through the button for events in multiple places.

Luckily we should be able to put a button field on our custom Event type. It turns out I'm the only person who has ever referenced this in code (it's used in canStartPress), so I can localize the changes to Scenery.

Assigning to @ariel-phet for prioritization (as the reward/work ratio for this seems somewhat low).

@jonathanolson
Copy link
Contributor Author

Also, we'd want to have an array of "buttons" pressed on the Mouse, instead of the three options we have now. (buttons being by number).

@zepumph
Copy link
Member

zepumph commented May 29, 2018

Note that this issue is the only thing holding up a new RC (spot check) of RIAW before publication.

@jonathanolson
Copy link
Contributor Author

I'm also deprecating Pointer.isDownProperty, it will need more fine-grained control (since that doesn't mention which mouse button is down).

@ariel-phet ariel-phet removed their assignment May 30, 2018
@ariel-phet
Copy link

This might be useful to handle more cleanly in the future, but given the very "edge-case" nature of the bugs reported, not worth putting in any effort at the moment

jonathanolson added a commit that referenced this issue May 30, 2018
@jessegreenberg
Copy link
Contributor

This was also noticed in phetsims/balloons-and-static-electricity#91 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants