Disable map zoom on CircleMarker double click in leaflet

All answers here are after the Leaflet map object has been initialized.

I'd like to give my take by stating that you can also disable doubleClickZoom during map object initialization.

Note: This will disable doubleClickZoom to the whole map and not just circleMarkers.

map = L.map('map', {
      center: [39.8282, -98.5795],
      zoom: 5,
      doubleClickZoom: false
    });

P.S. I'm running leaflet version 1.7.1


Following solution seems to work for me:

myCircle.ondblclick = function (event) {
    event.stopPropagation();
    return false;
};

I have also tried another one, which also works quite well in practice, but I find it a bit hacky:

myCircle.on("click", function () {
  map.doubleClickZoom.disable();
  setTimeout(function(){map.doubleClickZoom.enable();}, 1000);
});

None of the answers above worked for me:

  • calling native ev.originalEvent.preventDefault() did nothing
  • returning false neither
  • I don't like the doubleClickZoomworkaround that much (although… it works!)

Using Leaflet DomEvent did the job for me:


import { DomEvent } from 'leaflet';

myFeature.on("dblclick", function (ev) {
  DomEvent.stopPropagation(ev)
});

try

var myCircle = new L.CircleMarker(new L.LatLng(50.924480, 10.758276), 10).addTo(map);
map.doubleClickZoom.disable(); 

refer this document