nt.pch Posted June 12, 2015 Share Posted June 12, 2015 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, Quote Link to comment Share on other sites More sharing options...
xerver Posted June 13, 2015 Share Posted June 13, 2015 No thoughts without a concrete example. If something interactive is on top of something else interactive then only the top thing will receive events. Anything else I would consider a bug (even if it worked that way in v2). Quote Link to comment Share on other sites More sharing options...
nt.pch Posted June 15, 2015 Author Share Posted June 15, 2015 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. Quote Link to comment Share on other sites More sharing options...
xerver Posted June 15, 2015 Share Posted June 15, 2015 Ah, yeah that has changed in v3. There is technically no "Stage" anymore, just objects. If an interactive object is above something else it will block them. Sorry, should have thought of that. My bad! Quote Link to comment Share on other sites More sharing options...
nt.pch Posted June 15, 2015 Author Share Posted June 15, 2015 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. Quote Link to comment Share on other sites More sharing options...
xerver Posted June 15, 2015 Share Posted June 15, 2015 > 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. Quote Link to comment Share on other sites More sharing options...
nt.pch Posted June 16, 2015 Author Share Posted June 16, 2015 I'm going to pull this second issue out and start a new thread. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.