Jump to content

Pixi V3 interactivity blocked


nt.pch
 Share

Recommended Posts

Hi folks,

 

I have a game that I'm upgrading from v2 to v3 and I'm having issues with the interactivity of items on the stage.

 

The stage has 18 items and I'm trying to get one in the middle to respond to clicks. If I leave it in the middle it doesn't respond. If I re-add it to the top of the stage child list, then it reacts to mouse clicks as expected. 

 

In v2 there was no issue with the child being in the middle of the display list and if there were non-interactive assets above it, it still responded as expected.

 

Any thoughts?

 

Thanks,

 

Link to comment
Share on other sites

Ok, I think I found out what's going on.

 

In my game with Pixi v2, I had the stage set interactive = true, and then another object on the stage was responding to mouse events. Now in Pixi v3, the stage interactive = true seems to block the other object from responding. 

 

In this fiddle I was originally testing the layering, that appears to be working correctly as the red layer is responding to a click when clicking on the green box above it, but only when I comment out line 22 where the interactivity of the stage is set.

 

http://jsfiddle.net/13qt982r/9/

 

In Pixi v2, the red box would still respond to the mouse clicks.

Link to comment
Share on other sites

I think I wasn't clear. There's two things I was testing in this fiddle.

 

Originally the fiddle was to test if an object that was not interactive (and above another object) would block an object that was interactive below it. As expected, the above green non-interactive object does not block the below red interactive object.

 

 

The second test involves the parent object. Setting the parent container object to interactive, line 22, blocks the red child object from responding to mouse clicks. This is unexpected because in Pixi v2, the red child object did respond to mouse clicks when it's parent object was interactive.

Link to comment
Share on other sites

This is unexpected because in Pixi v2, the red child object did respond to mouse clicks when it's parent object was interactive.

 

Understandable. I would consider the behavior in v3 of not raising events on elements blocked by other interactive elements correct. If v2 let interactions fall through interactive elements I would consider that a bug that was fixed in v3. You can mention that you need that feature, if you do, on GitHub and we can try to discuss what makes the most sense for your use case.

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...