aratcliffe / Leaflet.contextmenu

A context menu for Leaflet.
MIT License
367 stars 107 forks source link

Please reimplement this as a map object #117

Open marcinn opened 5 years ago

marcinn commented 5 years ago

Hi.

Current implementation is something like an extension of Map/Marker object. This is a huge limitation. ContextMenu should be implemented as standalone layer (like Popup), should inherit from Layer/DivOverlay. Expose CM events (item-clicked, etc) instead of callback per menu item. What for? I.e. for using leaflet's event handling interface, which is currently not possible. Shortcut for creating menu via Map/Marker options may be preserved.

Thanks.

aratcliffe commented 5 years ago

Hi Marcin, I agree with your assessment. I wrote this plugin some years ago at a time when we were replacing our proprietary maps API with Leaflet and wanted to keep the interface as similar as possible to the existing popup implementation for compatibility reasons. As we're now exclusively working with Mapbox GL it's unlikely that I'll have the time to write another version for Leaflet but if I was to I'd do something similar to what you propose.