Ezelia / EZGUI

EZGUI - The missing GUI for Pixi.js and Phaser.io
http://ezgui.ezelia.com
440 stars 95 forks source link

Multiple click event firing #66

Open mourice opened 7 years ago

mourice commented 7 years ago

Hi I try to use Ezgui to show popup in my new game using phaserjs. Its really nice thanks for a nice popin effects. I have a phaser level screen when I click on any level popup comes up. What I am doing is on a click of phaser button I am registering a click event for play button which is a part of popup. But when I click play button of popup the play event fires 3 times. I trited to use off('click') but its also not working getting undefined. Any suggestions on how to handle this?

glaucomorais commented 6 years ago

In my case he fires twice.

glaucomorais commented 6 years ago

Ok.

I found an interesting fact: when the button is inside a Window component, the click callback is called one time by the window context and one time for the button context.

Phaser: 2.6.2 EZGUI: 0.3.3 beta

glaucomorais commented 6 years ago

A brief update: In my case when I have a unique button inside a Window, the click event is triggered twitce.

glaucomorais commented 6 years ago

Another update: Only the last children button has the click event triggered twice.

mourice commented 6 years ago

I have solution for this. I didn’t remember it right now but I will post an ans in a day for sure

glaucomorais commented 6 years ago

I actually added a extra button and set the position to be off-screen.