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

Click through? #43

Open
Shadowstep33 opened this issue Apr 6, 2016 · 5 comments
Open

Click through? #43

Shadowstep33 opened this issue Apr 6, 2016 · 5 comments

Comments

@Shadowstep33
Copy link

Hi, currently I have a Layout the size of the canvas but it is blocking the clicks of objects underneath. The layout contains some buttons, essentially at the corners of the screen:

is there a way to make an EZGUI component (Layout) ignore interaction, but allow some of its children components be interactive or do I have to add the buttons separately so there is no contiguous blocking element in front of the rest of the scene?

@alaa-eddine
Copy link
Contributor

this is possible, but I think that the behaviour was inconsistend between PIXI and Phaser.
to allow click through, you need to add an EZGUI click event handler, and set event.stopped to false.

if you can show a code examples it'll be easier to understand your issue :)

@fr0gs
Copy link

fr0gs commented Jul 11, 2016

Hello, I am also interested in this issue. I have a layout in the form:

{
  component: 'Window'
  children: [
    {
      component: 'Layout'
      children: [
        { id: 'btnClose', text: 'Close', component: 'Button', position: { x: 5, y: 5 }, width: 60, height: 40 },
      ]
    }
  ]
}

I've set an event listener like:

EZGUI.components.btnClose.on('click', () => {
  console.log("Close clicked!");
  aboutScreen.visible = false;
});

But I can't manage to make the click event to happen. I've also tried to add

z: 1

Or higher numbers like doc says at the level of Layout and Button without any results.

@alaa-eddine
Copy link
Contributor

Hello @fr0gs , have you tried to set btnClose z to a value and its parent z to a lower value ?
if you did and still not working can you please tell me what version of Phaser/Pixi are you using ?

@fr0gs
Copy link

fr0gs commented Jul 13, 2016

Hello @alaa-eddine , I've set btnClose z value to 10 and it's parent (the Layout component) z value to 1, still no luck. I've seen that among the examples in this repo a very similar structure is shown and it works properly, I may miss something.
I am using Phaser 2.4.9 and the phaser-compat-2.4 file from the dist/ folder in EZGUI

@fr0gs
Copy link

fr0gs commented Jul 15, 2016

Oki doki, with Phaser 2.4.9 EZGUI does not respond to any events in the GUI definition. I will keep trying with older versions.

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

No branches or pull requests

3 participants