-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4.0.1 The onPointerLeave
function is not activating.
#713
Comments
feat(events)!: pointerevents manager and state #529 mentioned that the code no longer works, maybe in a certain version Is it working normally? But it cannot run for bandicam.2024-06-02.14-41-19-353.mp4 |
My current approach to solving this issue involves maintaining a collection to store objects that are no longer intersected by rays. This collection is then used to trigger the let prevIntersections: Intersection[] = []
let differenceSetObject: TresObject[] = []
onPointerMove((event) => {
// Current intersections mapped as meshes
const hits = event.intersections.map(({ object }) => object)
differenceSetObject = prevIntersections.filter((hit) => !hits.includes(hit))
differenceSetObject.forEach(() => {
propogateEvent('onPointerLeave', event)
propogateEvent('onPointerOut', event)
})
// .......
// Update previous intersections
prevIntersections = hits as unknown as Intersection[]
}) |
"It is work." bandicam.2024-06-02.17-19-26-757.mp4after bandicam.2024-06-02.16-44-15-809.mp4 |
Hi! Thanks for the reproduction, it's helped me nail down the issue Looks like I had an oversight in the event system and relied too much on the intersections array. Since these are pointer-leave/out events we won't have intersections in array to propagate with. Working on a fix now, will comment when a PR is up |
I've got a PR up(#716) with the fix |
@hawk86104 @hexianWeb The fix was released this morning is Please give that a try and report back when you get a chance 🙂 |
Thank you for the update! I will give |
LGTM, this was a timely and effective fix. |
Describe the bug
As shown in the StackBlitz URL example,
onPointerLeave
was activating in version 3.9 and earlier. However, in version 4.0 and later, it is difficult to activate. How can I useonPointerLeave
?This way of using it is not a good practice.
Reproduction
https://stackblitz.com/edit/tresjs-minimal-reproduction-kentgx?file=src%2Fcomponents%2FTheExperience.vue,src%2FApp.vue
Steps to reproduce
No response
System Info
No response
Used Package Manager
yarn
Code of Conduct
The text was updated successfully, but these errors were encountered: