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

GUI_Object binds both down & enter pointer events #686

Closed
agmcleod opened this issue May 27, 2015 · 14 comments
Closed

GUI_Object binds both down & enter pointer events #686

agmcleod opened this issue May 27, 2015 · 14 comments
Labels
Milestone

Comments

@agmcleod
Copy link
Collaborator

me.input.registerPointerEvent("pointerenter", this, this.clicked.bind(this));

Realized due to bug in: https://groups.google.com/forum/#!topic/melonjs/204CYK6Yoe4

Given that pointerenter is the event that does not bubble for entering a section, I don't see how this should resolve to onClick. So i think we have 3 options:

  1. Remove the calls to pointerenter & pointerleave
  2. Keep the events, but bind to different callback functions. onEnter, onLeave
  3. Change the constructor to accept options of what events should be bound.
@agmcleod agmcleod added the Bug label May 27, 2015
@parasyte
Copy link
Collaborator

At a minimum, the pointerleave event needs to stay. GUI_Object might benefit from a new cancel action, instead of performing a click action when the pointer leaves the GUI rect.

@agmcleod
Copy link
Collaborator Author

Agreed on the cancel bit. But why do we need the pointerleave?

@parasyte
Copy link
Collaborator

For cases like this: blipjoy/sprung_fever#2

@agmcleod
Copy link
Collaborator Author

Ah okay, was thinking about it like with DOM events. Typically a mouseup on
a dom element will still fire on that element, but here we're doing at run
time rect calculation.

On Wed, May 27, 2015 at 3:20 PM Jay Oster [email protected] wrote:

For cases like this: blipjoy/sprung_fever#2
blipjoy/sprung_fever#2


Reply to this email directly or view it on GitHub
#686 (comment).

@obiot
Copy link
Member

obiot commented May 28, 2015

agree, the pointerEnter event should not trigger the onClicked event, but rather use a specific callback (onEnter, onLeave as suggested by Aaron).

if we all agree, I can modify this for inclusion in the 2.1.1 release ?

@obiot obiot added this to the 2.1.1 milestone May 29, 2015
obiot added a commit that referenced this issue May 29, 2015
@obiot
Copy link
Member

obiot commented May 29, 2015

hi guys, see the above commit : is this what we all agreed on ?

obiot added a commit that referenced this issue May 29, 2015
@parasyte
Copy link
Collaborator

As long as the default onLeave handler cancels the current hover/click state.

@obiot
Copy link
Member

obiot commented May 29, 2015

tell me again why the onPointerLeave event should also cancel the click state ?

@parasyte
Copy link
Collaborator

I posted the reason in this ticket two days ago. 😞 Here's the link again: blipjoy/sprung_fever#2

If leave doesn't cancel the click, you get really broken behavior.

@obiot
Copy link
Member

obiot commented May 29, 2015

Ahha sorry, I saw it actually, but then just forgot, must be one of these "senior moments" :p

On 29 mai 2015, at 11:38, Jay Oster [email protected] wrote:

I posted the reason in this ticket two days ago. Here's the link again: blipjoy/sprung_fever#2

If leave doesn't cancel the click, you get really broken behavior.


Reply to this email directly or view it on GitHub.

@obiot
Copy link
Member

obiot commented May 29, 2015

we should be all set now then ! :p

i also added a test on the release flag to avoid multiple event triggering :
1bbc4e2#diff-4542aeba5835ce6807cf6e36a774d767R205

@obiot
Copy link
Member

obiot commented May 30, 2015

everybody's happy with this one ?

@agmcleod
Copy link
Collaborator Author

Yep
On Sat, May 30, 2015 at 11:37 AM Olivier Biot [email protected]
wrote:

everybody's happy with this one ?


Reply to this email directly or view it on GitHub
#686 (comment).

@obiot
Copy link
Member

obiot commented May 30, 2015

great, I will wait the feedback from Lamberto before closing it anyway

obiot added a commit that referenced this issue May 30, 2015
@obiot obiot closed this as completed May 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants