Skip to content

Fix Bug: preventMarkerRremoval #597

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

Merged
merged 6 commits into from
Jun 20, 2020

Conversation

Falke-Design
Copy link
Collaborator

Added check for Marker or CircleMarker to the function:

enableGlobalRemovalMode() {
    const isRelevant = layer =>
      layer.pm &&
      !((layer instanceof L.Marker || layer instanceof L.CircleMarker) && layer.pm.options && layer.pm.options.preventMarkerRemoval) &&
      !(layer instanceof L.LayerGroup);

Fix: #576

@@ -16,7 +16,7 @@ const GlobalRemovalMode = {
enableGlobalRemovalMode() {
const isRelevant = layer =>
layer.pm &&
!(layer.pm.options && layer.pm.options.preventMarkerRemoval) &&
!((layer instanceof L.Marker || layer instanceof L.CircleMarker) && layer.pm.options && layer.pm.options.preventMarkerRemoval) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here explaining when a layer is relevant?
I would also like to see a test for this - otherwise it will be quite hard to debug when this causes a bug or unexpected behaviour in the future

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I re-thinked about that ... Why is it checking for preventMarkerRemoval? Because it only adds a click event and that is allowed for all Markers no matter if the option preventMarkerRemoval is passed.

preventMarkerRemoval only restrict that a Marker can't deleted by right clicking (contextmenu).

My suggestion is to remove the complete line.

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean the preventMarkerRemoval option has no effect here right now? I think you are right, in which case this can be deleted.

Copy link
Contributor

@codeofsumit codeofsumit left a comment

Choose a reason for hiding this comment

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

Remove the test for preventMarkerRremoval should fix the bug

@@ -16,7 +16,7 @@ const GlobalRemovalMode = {
enableGlobalRemovalMode() {
const isRelevant = layer =>
layer.pm &&
!(layer.pm.options && layer.pm.options.preventMarkerRemoval) &&
!((layer instanceof L.Marker || layer instanceof L.CircleMarker) && layer.pm.options && layer.pm.options.preventMarkerRemoval) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

You mean the preventMarkerRemoval option has no effect here right now? I think you are right, in which case this can be deleted.

@Falke-Design
Copy link
Collaborator Author

@codeofsumit I deleted the line with preventMarkerRemoval

@codeofsumit codeofsumit merged commit 383c38d into geoman-io:develop Jun 20, 2020
@Falke-Design Falke-Design deleted the preventMarkerRemoval branch July 5, 2020 13:32
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