Skip to content
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

SelectionHelper: ensure DOM cleanup #30473

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

trusktr
Copy link
Contributor

@trusktr trusktr commented Feb 6, 2025

Description

Ensure DOM is cleaned up in case SelectionHelper.dispose() is called during an incomplete dragging operation.

Example scenario: if a view changes to another view and the selection should no longer apply, we don't want the selection rectangle to remain leaked on screen.

This contribution is funded by Lume (3D HTML framework)

@@ -59,6 +59,8 @@ class SelectionHelper {
this.renderer.domElement.removeEventListener( 'pointermove', this.onPointerMove );
this.renderer.domElement.removeEventListener( 'pointerup', this.onPointerUp );

this.element.remove(); // in case disposal happens while dragging
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind changing line 98 from:

this.element.parentElement.removeChild( this.element );

to

this.element.remove();

as well? This style is a lot cleaner.

@Mugen87 Mugen87 added this to the r174 milestone Feb 6, 2025
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