Sign in to follow this  
fela98

Mouse Event wrong stage.children order

Recommended Posts

Hello to all pixi fans  :)

 

I have a problem, when i reorder a DisplayObjectContainer's children array, the mouse events are not reordered (so it seems atleast).

 

Here is the fiddle: http://jsfiddle.net/fela98/oer4828L/3/

 

The MouseEvents are not dispatched to the correct Sprites. Sometimes am I dragging a sprite that is behind the on I clicked.

 

Am I supposed to reorder the children array manually or should i only do it with the swapChildren method?

Am I doing something wrong or is this a bug?

 

Thanks in advance!

Share this post


Link to post
Share on other sites

I finally figured it out. Posting this for future readers.

 

I found out that the Interaction graph had to be rebuilt when something was reordered in the stage array.

 

I looked at the source of the InteractionManager and found this:

http://www.goodboydigital.com/pixijs/docs/files/src_pixi_InteractionManager.js.html#l359

 

when i called this after reordering the elements, everything worked fine.

 

Also in the first fiddle i accedentally included an old version of pixi.

Here is a new fiddle with a new version and with:

stage.interactionManager.rebuildInteractiveGraph()

http://jsfiddle.net/fela98/oer4828L/9/

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.