Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 understand the first part of this conditional but am I thinking about it correctly that
map.listens('contextmenu')
would betrue
if acontextmenu
listener has been set up on the map? Why would having a listener prevent the event? It seems like odd behavior that I could disable drag rotate, set up a listener forcontextmenu
and then the context menu wouldn't actually open.Also, the docs say that
listens
should returnfalse
if no listener is set up, but I actually getundefined
.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.
The original reason for having Map
contextmenu
event is to allow specifying custom behavior on right click, such as opening your own HTML-styled app-specific context menu, and in this case it doesn't make sense to also show the browser default one.Leaflet does the same thing and no one raised concerns about it yet, so I think it's safe to do the same logic here.
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.
Ah, ok that makes sense. I tested this on Mac with Safari, Firefox and Chrome and they all worked as expected so I think this is good.
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.
This is not working in ios WKWebView.