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

Improve support for drawing items in ui.leaflet #3586

Merged
merged 6 commits into from
Aug 28, 2024
Merged

Improve support for drawing items in ui.leaflet #3586

merged 6 commits into from
Aug 28, 2024

Conversation

falkoschindler
Copy link
Contributor

@falkoschindler falkoschindler commented Aug 24, 2024

In #2422 we noticed that ui.leaflet didn't preserve drawn items, making it impossible to edit or delete them.

  • This PR adds newly created layers to the drawnItems feature group, allowing to modify them using the draw controls. It also removes the need to add drawn items in user code. This breaking change has been deliberately scheduled for the release of version 2.0.0.
  • To allow rendering drawn items with custom options like before, a new parameter hide_drawn_items allows to opt-out of the new behavior.
  • The PR also fixes cyclic references in some event arguments, allowing to subscribe to events like "draw:created", "draw:edited" and "draw:deleted".
  • It does not implement synchronization of drawn layers with the server. This means that drawn items are not synchronized on the auto-index page and cleared when reloading it. Extracting all information from the event arguments and using it to create drawn layers programmatically on the client turned out pretty complicated. And because Leaflet is on the verge of releasing version 2.0, I decided not to spend too much time trying to dig into the API and data structures of version Leaflet 1.9.

Open tasks:

  • demo showing how to edit and remove drawn items
  • demo how to draw items with custom options

@falkoschindler falkoschindler added the enhancement New feature or request label Aug 24, 2024
@falkoschindler falkoschindler added this to the 2.0.0 milestone Aug 24, 2024
@falkoschindler falkoschindler changed the title Prepare ui.leaflet for drawing support Improve support for drawing items in ui.leaflet Aug 24, 2024
@rodja
Copy link
Member

rodja commented Aug 26, 2024

I think we should add demos on how a drawn item can be modified and another showing how to draw items with custom options.

@rodja rodja merged commit 0ad7478 into 2.0 Aug 28, 2024
5 of 6 checks passed
@rodja rodja deleted the leaflet branch August 28, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants