Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

PEP skipping first event (pointerdown) #292

Closed
niclaslindberg opened this issue Jun 2, 2016 · 4 comments
Closed

PEP skipping first event (pointerdown) #292

niclaslindberg opened this issue Jun 2, 2016 · 4 comments

Comments

@niclaslindberg
Copy link

niclaslindberg commented Jun 2, 2016

I have noticed that PEP skips the fist event sometimes. In my cases it happened after clearing a canvas or when showing a Boostrap Modal for the second time (buttons event handlers were only invoked the second time).

The stupid fix below removes the problem but I'm sure it's not the way to go.

  mousedown: function(inEvent) {
            if (!this.isEventSimulatedFromTouch(inEvent)) {
                var p = mouse__pointermap.get(this.POINTER_ID);
                var e = this.prepareEvent(inEvent);
                if (!HAS_BUTTONS) {
                    e.buttons = BUTTON_TO_BUTTONS[e.button];
                    if (p) { e.buttons |= p.buttons; }
                    inEvent.buttons = e.buttons;
                }
                mouse__pointermap.set(this.POINTER_ID, inEvent);
                p=undefined; // The error occurs when p is defined.
                mouse__pointermap.delete(this.POINTER_ID); //Clear it
                if (!p) {
                    _dispatcher.down(e);
                } else {
                    _dispatcher.move(e);
                }
            }
        },
@bethge
Copy link
Contributor

bethge commented Jun 2, 2016

Could you create an example demonstrating the issue on e.g. http://jsbin.com?

Also, which browser are you using?

@niclaslindberg
Copy link
Author

Hi.

https://jsbin.com/gagifa/3/edit

First time you click the button an alert is shown. The second time
nothing happens. The third time the alert shows again.

// Niclas

On 06/02/2016 09:31 AM, Marius Stefan Bethge wrote:

Could you create an example demonstrating the issue on e.g.
http://jsbin.com?

Also, which browser are you using?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#292 (comment), or
mute the thread
https://github.com/notifications/unsubscribe/AD4QRP7WrxY6N19t6Kvxi42gW1TbJDQjks5qHoa9gaJpZM4IsRV-.

@patrickhlauke
Copy link
Collaborator

I'll have a guess and say it's because PEP loses track of the pointer, as after pointerdown the mouse is moved over to the alert, so it never sees the pointerup. after you dismiss the alert, next time you press the button PEP likely is still in a state where it's expecting the up so it can fire pointerup to finish the sequence that was started with the original pointerdown.

As a workaround for now: if you change it to react to pointerup, it works as it should (more generally, you may as well just listen to click, but that may just be the case for the simplified test case)

@scottgonzalez
Copy link
Contributor

This appears to be a duplicate of #279.

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

No branches or pull requests

4 participants