Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Nov 26, 2024

Description

Noticed this when messing with the InteractiveGroup utility. The event listeners are bound in the listenTo methods, but they're not removed when the group is removed from the scene. I added a disconnect method which does this explicitly.

As there's a stopPropagation in the onPointerEvent, adding an interactive group to the scene and removing it later would prevent any of the pointer event listeners firing that were bound earlier.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 4, 2025

I have slightly refactored the PR since it contained JS syntax that breaks our current ESLint settings (we stick to ECMA 2018 atm).

Would the updated code work for you?

@Mugen87 Mugen87 changed the title fix: disconnect event listeners in InteractiveGroup InteractiveGroup: Add disconnect(). Jan 4, 2025
@ghost
Copy link
Author

ghost commented Jan 6, 2025

I have slightly refactored the PR since it contained JS syntax that breaks our current ESLint settings (we stick to ECMA 2018 atm).
Would the updated code work for you?

Thank you, happy with the changes

@Mugen87 Mugen87 added this to the r173 milestone Jan 6, 2025
@Mugen87 Mugen87 merged commit 4b2119b into mrdoob:dev Jan 6, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants