riccioverde11 Posted February 17, 2020 Share Posted February 17, 2020 (edited) Hello community, I have a Graphics, say a circle, and inside i nest another circle with addChild property. If to both the graphics i add a listener such as "mouseover", how do i prevent the "father" to fire when i'm just hovering the "child" circle? Regards. Edited February 17, 2020 by riccioverde11 ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Vlados Posted February 17, 2020 Share Posted February 17, 2020 You can use property .currentElement to check possition of your mouse (above which element it is - whether parent of child) Also take a look at optional third parameter of eventlistener - capturing riccioverde11 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 17, 2020 Share Posted February 17, 2020 http://pixijs.download/release/docs/PIXI.interaction.InteractionEvent.html#stopPropagation riccioverde11 1 Quote Link to comment Share on other sites More sharing options...
riccioverde11 Posted February 18, 2020 Author Share Posted February 18, 2020 (edited) 11 hours ago, Vlados said: You can use property .currentElement to check possition of your mouse (above which element it is - whether parent of child) Also take a look at optional third parameter of eventlistener - capturing Apparently stopPropagation should do the job in a more succinct way. About the third parameter, where did you find the docs? Cause on my intellisense the third parameter is context. Also 11 hours ago, ivan.popelyshev said: http://pixijs.download/release/docs/PIXI.interaction.InteractionEvent.html#stopPropagation I tried this solution and it works fine, although I have another issue now. The inner circle will stop the propagation much so, that if now i actually hover on the father, it won't trigger anything. My best guess is that by stopping the propagation the father lost his chance to fire. Do i have to manually call it? Edited February 18, 2020 by riccioverde11 Quote Link to comment Share on other sites More sharing options...
jonforum Posted February 18, 2020 Share Posted February 18, 2020 (edited) 2 hours ago, riccioverde11 said: where did you find the docs? Cause on my intellisense the third parameter is context. Intellisense is not perfect, sometime you need help him, especially for events. Am not using maybe the best solution but it work for me. Edited February 18, 2020 by jonforum 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.