-
Notifications
You must be signed in to change notification settings - Fork 443
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
Fix Bug: preventMarkerRremoval #597
Conversation
typo globaldrawmodetoggled --> globaldragmodetoggled
Create Base
Updated Swedish translations (geoman-io#571) (patch)
src/js/Mixins/Modes/Mode.Removal.js
Outdated
@@ -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) && |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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
src/js/Mixins/Modes/Mode.Removal.js
Outdated
@@ -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) && |
There was a problem hiding this comment.
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.
@codeofsumit I deleted the line with |
Added check for Marker or CircleMarker to the function:
Fix: #576