Skip to content

Commit

Permalink
Remove raycaster-closest-entity-changed listener when removing cursor…
Browse files Browse the repository at this point in the history
… component, this fixes getIntersection on undefined error when we remove cursor and raycaster components on the scene and there is a hand raycaster emitting this event (#5625)
  • Loading branch information
vincentfretin authored Jan 10, 2025
1 parent 318f320 commit 112df7d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ module.exports.Component = registerComponent('cursor', {
el.removeEventListener(upEvent, self.onCursorUp);
});
el.removeEventListener('raycaster-intersection', this.onIntersection);
el.removeEventListener('raycaster-closest-entity-changed', this.onIntersection);
el.removeEventListener('raycaster-intersection-cleared', this.onIntersectionCleared);
canvas.removeEventListener('mousemove', this.onMouseMove);
canvas.removeEventListener('touchstart', this.onMouseMove);
Expand Down

0 comments on commit 112df7d

Please sign in to comment.