Kristiyan Posted January 11, 2019 Share Posted January 11, 2019 Hello everyone! I have pointerover event and i want to get the element i point on (hover on).But when i use event.currentTarget , it is null,also tried with event.target which is also null. Any suggestions ? sprite.on('pointerover',function(event){console.log(event.target,event.currentTarget)}); // target and currentTarget are null ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Kristiyan Posted June 27, 2019 Author Share Posted June 27, 2019 On 1/11/2019 at 2:31 PM, Kristiyan said: Hello everyone! I have pointerover event and i want to get the element i point on (hover on).But when i use event.currentTarget , it is null,also tried with event.target which is also null. Any suggestions ? sprite.on('pointerover',function(event){console.log(event.target,event.currentTarget)}); // target and currentTarget are null google chrome console says that target and currentTarget are null, but actually they are not . Maybe a chrome bug. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 27, 2019 Share Posted June 27, 2019 https://github.com/pixijs/pixi.js/pull/5695 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 27, 2019 Share Posted June 27, 2019 Congrats with first post! PixiJS is very active community, and you found the stuff we are already investigating. You can give your input on the problem in that PR. Also, here's the build from that PR you can use to test: http://pixijs.download/bugfix/touchmove-target/pixi.js Quote Link to comment Share on other sites More sharing options...
Kristiyan Posted June 27, 2019 Author Share Posted June 27, 2019 5 minutes ago, ivan.popelyshev said: Congrats with first post! PixiJS is very active community, and you found the stuff we are already investigating. You can give your input on the problem in that PR. Also, here's the build from that PR you can use to test: http://pixijs.download/bugfix/touchmove-target/pixi.js @ivan.popelyshev actually the event fires correctly , the target is correct, i saw it with debugging with chrome, but when i console log the event.target , it says null, and im watching it from chrome debuger that it is not null .It was really strange. Quote Link to comment Share on other sites More sharing options...
Kristiyan Posted June 27, 2019 Author Share Posted June 27, 2019 this bug was in January, i have no saved screenshots or logs. But nvm, i succeed with the game, and now i saw my question unanswered and i decided to give it a reply, because someone else can experience the same problem.I want to help him to not loose time . Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 27, 2019 Share Posted June 27, 2019 maybe you used console.log(event), in that case there's some kind of async logic there Kristiyan 1 Quote Link to comment Share on other sites More sharing options...
Kristiyan Posted June 27, 2019 Author Share Posted June 27, 2019 1 minute ago, ivan.popelyshev said: maybe you used console.log(event), in that case there's some kind of async logic there yes, console.log(event) .And after log it, the object properties target and currentTarget were with value null,but as i said, from debugger i saw that everything is ok. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 27, 2019 Share Posted June 27, 2019 we reuse that object, and console actually shows it contents a bit later. You can be sure only about link itself, not about contents, someone could already change them. Kristiyan 1 Quote Link to comment Share on other sites More sharing options...
Kristiyan Posted July 1, 2019 Author Share Posted July 1, 2019 On 6/27/2019 at 5:58 PM, ivan.popelyshev said: we reuse that object, and console actually shows it contents a bit later. You can be sure only about link itself, not about contents, someone could already change them. I agree! Thank you @ivan.popelyshev ,always competent answers ? ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
jonforum Posted July 2, 2019 Share Posted July 2, 2019 haha, debugger also fooled me ! it because `console.log(event.target,event. currentTarget )` create references. And when you open (clickOn) the reference in the debugger , it compute again but no longer exist because it already cleared with the method `.reset(); ` i remember i also ask this here. https://github.com/pixijs/pixi.js/issues/5056 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.