Nested raycasters cause false intersections on parent raycasters due to event bubbling
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 4.4k
- PR merge metrics
- No merged PRs in 30d
Description
Description:
- A-Frame Version: 1.3
- Platform / Device: NA
- Reproducible Code Snippet or URL:
<a-scene cursor="mouse" raycaster>
<a-entity cursor></a-entity>
</a-scene>
When the cursor on the entity hits an object it does an intersection and events are fired
It then bubbles up the DOM tree and reaches the a-scene which sees an intersection event assumes that it is it's own and fires off it's own intersection events so anything listening for intersection events now thinks the a-scene cursor intersected it when it did not.
The fix is to check for event.currentTarget === event.target in onIntersection in cursor.js
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in cursor.js at onIntersection and reproduce the nested cursor and raycaster setup from the issue. Verify that the parent scene does not treat bubbled child intersections as its own, while direct intersections still produce the expected events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100