Skip to content

Commit 112df7d

Browse files
Remove raycaster-closest-entity-changed listener when removing cursor 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)
1 parent 318f320 commit 112df7d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/components/cursor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ module.exports.Component = registerComponent('cursor', {
196196
el.removeEventListener(upEvent, self.onCursorUp);
197197
});
198198
el.removeEventListener('raycaster-intersection', this.onIntersection);
199+
el.removeEventListener('raycaster-closest-entity-changed', this.onIntersection);
199200
el.removeEventListener('raycaster-intersection-cleared', this.onIntersectionCleared);
200201
canvas.removeEventListener('mousemove', this.onMouseMove);
201202
canvas.removeEventListener('touchstart', this.onMouseMove);

0 commit comments

Comments
 (0)