Megakoresh Posted December 15, 2016 Share Posted December 15, 2016 If I set a parent to be interactive and then add some interactive children to it, their defaultCursor property does not work. Demonstration. Should be pretty obvious what I am trying to do, but in case it's not: I intend to allow the user to scale that green thing with those handles. The code to look at is let handle4 = new PIXI.Graphics().beginFill(0xFF0000, 1).drawCircle(handleRect.x+wonderfulRectangle.width, handleRect.y+wonderfulRectangle.height, 10).endFill(); handle4.interactive = true; handle4.button = true; handle4.hitArea = new PIXI.Circle(handle4.x, handle4.y, 10) handle4.defaultCursor = "nwse-resize"; handleRect.addChild(handle4); handleRect is added to the wonderfulRectangle. wonderfulRectangle is interactive (can be moved around as you can see). If I set defaultCursor on the wonderfulRectangle (i.e. - parent), it works fine. But neither handleRect nor handle4 work. Is this a bug, or am I missing some undocumented steps here? Quote Link to comment Share on other sites More sharing options...
Megakoresh Posted December 15, 2016 Author Share Posted December 15, 2016 You can also probably observe how for some reason if set any child to be interactive, you can actually grab it and move it around, and it would act as a parent, despite there being no event listeners attached to it. I can prevent this by actually adding an event listener for the same event to EVERY interactive child and then calling event.stopPropagation(), but that seems excessively counter-productive. If the child isn't listening to an event, but the parent is, the parent must receive the event, even if the child is on top. This behaviour is highly illogical, it looks like a bug. Should I open an issue on Github? UPDATE: I worked around the issue by creating a non-interactive PIXI.Container() and placing items in there. I then use event.target.parent's position and modify that. However that should not be necessary. If nobody replies for the next few hours with some instructions of a "proper" solution, I'll assume it's a bug and create an issue. I just don't wanna rush that, seeing as there are already friggin 200+ issues for this library on Github... 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.