Tony Lugg
Tony Lugg

Reputation: 572

Mapbox Right Mouse Click

I'm using the L.map contextmenu to listen for right clicks on the map. However, when I right click the map, in addition to the contextmenu event being fired, it also fires the mousedown event and the MouseEvent data does not indicate which mouse button was pressed, so the "left press" code is executed in addition to the "right press" code. Is there a way to get around this?

Thanks in advance.

Tony

Upvotes: 2

Views: 5000

Answers (1)

iH8
iH8

Reputation: 28658

If you want to listen to left click you must use the click event, if you want to listen for rightclick you must use the contextmenu event. The mousedown event fires on left and right click. It does exactly what it's supposed to do.

Upvotes: 5

Related Questions