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

Clear RenderBox on DragBox Deactivation #15671

Merged
merged 6 commits into from
Mar 26, 2024
Merged

Conversation

behoney
Copy link
Contributor

@behoney behoney commented Mar 26, 2024

Currently, when the DragBox interaction is deactivated by calling setActive(false), the RenderBox (which visually represents the dragged area) remains on the map. This Pull Request should resolve #15571 by clearing the RenderBox when the DragBox is deactivated.

Changes

In the setActive method of the DragBox class, a new line has been added to call the disposeInternal method of the box_ (RenderBox) instance when active is set to false. This will ensure that the RenderBox is properly disposed and removed from the map.

Copy link

📦 Preview the website for this branch here: https://deploy-preview-15671--ol-site.netlify.app/.

Copy link
Member

@ahocevar ahocevar left a comment

Choose a reason for hiding this comment

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

Thanks, @behoney! I think the BOXCANCEL event should only be fired when a box is currently being drawn, so I added a suggestion to change this. Looks good otherwise.

src/ol/interaction/DragBox.js Outdated Show resolved Hide resolved
Co-authored-by: Andreas Hocevar <andreas.hocevar@gmail.com>
src/ol/interaction/DragBox.js Outdated Show resolved Hide resolved
behoney and others added 2 commits March 26, 2024 21:59
Co-authored-by: M393 <56256405+M393@users.noreply.github.com>
Copy link
Member

@ahocevar ahocevar left a comment

Choose a reason for hiding this comment

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

Thanks, @behoney

@ahocevar ahocevar merged commit 450a865 into openlayers:main Mar 26, 2024
8 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.

Clear RenderBox on DragBox Deactivation
3 participants