Are pointerOn events async? #2933
Unanswered
Barricature
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to rely on
pointerOn
andpointerOut
events to highlight objects. But I noticed that they don't seem to be happening strictly in alternation.My scene has nested Object3Ds, and each of them listens to pionter events. The idea is to be able to switch the highlight level, so I call
event.stopPropagation()
ifobjectLevel === currentLevel
and then do the highlight and unhighlight thing. I initial thought is that the event will be captured like this:So that I the
stopPropagation()
call will not deal out extrapointerOut
events and I can simply turn highlight on and off. I don't know what might be causing one object to be receiving more than onepointerOn
orpointerOut
event in a row and my guess is that the bubbling happens asynchronously?The document seems to have suggestions but I don't exacly understand them. If my question is already answered in the doc could I get a little more explanation? Thank you very much!
My implementation is as below: (I fixed the problem by tracking the last intersected object but I don't know if it's the best solution)
Beta Was this translation helpful? Give feedback.
All reactions