Jump to content

pixi pointerevent currentTarget = null ?


Kristiyan
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

  • 5 months later...
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.

Link to comment
Share on other sites

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 :D .It was really strange.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites


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

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