-
Notifications
You must be signed in to change notification settings - Fork 2k
only 1 pressup triggered after 2 consecutive mousedown #551
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
Comments
I looked at the source, couldn't really find a fix, but the problem seems to be in the Stage's _handlePointerUp() function. That function is called for both the pressup events, but in the second time the 'oTarget' variable doesn't get the proper target. Couldn't really figured out the reason why that happens. If you do something like this here: https://github.com/CreateJS/EaselJS/blob/master/src/easeljs/display/Stage.js#L723
then you actually get the 2 pressup events. Of course this is not the fix, but maybe it can help someone more into the codebase. |
Looks like it doesn't differentiate between left click and right click when it comes to the Then, later, it's setting the pointerData's target to null when |
You are right, the problem is that it isn't differentiating between the different mouse buttons, both get the same id, so it ends up reusing the same object (from _pointerData). |
Good catch. I'll check out the pull request, and see what the best approach to fix this is. Note that right now some mouse interactions use the "-1" mouse id as an indicator that the interaction is not a touch. Perhaps we could switch those to check for |
Yes, I can make that change, just see what is the best approach. |
Cool. If you want to take a stab at it, I'd be happy to review and sanity check / test your updated Pull Request. Thanks! |
I've updated the pull request. I don't really know where the touch part is in the code though. |
Have you considered using a bit field (or even boolean array) to mark which buttons are currently pressed (and setting down/releasing the target only when none are marked as pressed) and storing it in the one pointerData? It doesn't seem like having each button have its own pointerData fits with the word "pointer". I'm not sure we can count on always getting mouseups (so we can clear the target), but if that's a problem then the original had it too. I saw mention of a |
The pointerData has other information than just if its being pressed though, don't know how you would fit that in a bit field. |
Actually, I meant as a property of the pointerData object. |
So would we check the state of the buttons on the (next) mouse down event (to see if there was a missing mouseup event)? And release there the target. Not sure I follow your idea completely. Right now the target is removed when 'clear' is not true, and it seems that its only true for touch. |
Hey guys is there any news on a fix for this issue? It's affecting a game I am writing. Which is here http://www.galaxyexplorer.net/ (When you click and release the left and right mouse button only one button is released). Thanks! Bobby |
I implemented noobiepts change and it solved my issues 👍 |
I found this thinking it was an error in my code, it happens with 0.7.1 and 0.8.0
I don't know if this is the correct behaviour, but if you press 2 mouse buttons without releasing them, you get 2 "mousedown" events, after releasing the buttons you only get 1 "pressup" event.
If you believe this is the correct behaviour, is there any easy way to generate both pressup events? Thank you.
0.7.1 and 0.8.0 examples:
http://jsfiddle.net/ncknqtaw/
http://jsfiddle.net/ncknqtaw/1/
The text was updated successfully, but these errors were encountered: