0

I need to bind a custom click function on the drawn shapes. I'm using the following code for that:

map.on('pm:create', function(e) {
    e.layer.on('click', function(e) {
        document.getElementById('info-pane').style.display = 'block';
    });
});

When I bind this new click function, I'm not able to remove the shape anymore. When I am in the remove mode, the click is triggering the show info-pane instead of remove the shape.

How can I bind a custom click function to the shapes without "deactivate" any leaflet-geoman functionality such as the Remove ?

Kleyson Rios
  • 2,597
  • 5
  • 40
  • 65

1 Answers1

1

Well,

Including this L.DomEvent.stopPropagation(e); seems to be working now.

map.on('pm:create', function(e) {
    e.layer.on('click', function(e) {
        document.getElementById('info-pane').style.display = 'block';
    });

    L.DomEvent.stopPropagation(e);
});
Kleyson Rios
  • 2,597
  • 5
  • 40
  • 65