fis-sst / BlazorMaps

BlazorMaps is a Blazor library that provides a C# interface for maps provided by Leaflet.js library. It includes several Leaflet.js features which are easily accessible from C# level within a project and it does not require any use of JavaScript.
https://fis-sst.pl/en
MIT License
70 stars 25 forks source link

Add preventDefault to map and marker events #19

Open mrunks opened 2 years ago

mrunks commented 2 years ago

Is your feature request related to a problem? Please describe. I am looking for a way to add or use preventDefault on Map and Marker events such as click, double click, contextmenu.

Describe the solution you'd like

I have a contextmenut in an angular app that uses preventDefault as shown in the last line. I am not sure how this can be done in for markers and Maps in Blazor

this.map.on('contextmenu', function (e: any) { const originalEvent = e.originalEvent as MouseEvent; originalEvent.preventDefault(); }

this.marker.addEventListener('dblclick', function (e: any) { const evt = e.originalEvent as MouseEvent; evt.preventDefault(); }