Jump to content

A doubt about Container Event


Likl
 Share

Recommended Posts

First, I draw a PIXI.Container, but don't set it's position.Then,  I put a PIXI.Sprite in it which has a specific x,y,width and height,  

through the console, i saw that the container's position is set to {x: 0, y: 0}, and it size is wrapping the sprite

When I bind some MouseOver event on the container , it seems that it onlyt triggered on the sprite, ummm, i mean

there is a blank part in the container but didn't trigger event. Is it normal?

What if I want to expand the zone of the MouseOver event on sprite?

Link to comment
Share on other sites

Yes, Flash worked like that too. Container doesn't have size per se, its just bounds of all children. Interaction works through children too - if something is hit , then container is hit too.

I advice you to not use "container.width, container.height" at all because that calls getLocalBounds() which i doubt you need - its legacy Flash behaviour, and in pixi it has some nasty side effects.

Use  "container.getBounds()" to get debug info.

Edited by ivan.popelyshev
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...