leaflet map on click detect layer

by vulkan   Last Updated September 11, 2019 10:22 AM

I added a click event to the map.

but when I click on a layer on the map, I want to disable this click event.

I have to write a condition in the map click event.

How can I find if there is a layer when clicking on the map?

this._map.on('click', (e)=>{
 if(/* what should I write? */){
  // code
  // code
Tags : layers events

Related Questions

Marker layer not responding to events in OpenLayers

Updated April 04, 2015 22:09 PM

Trigger event after KML Layer completely loaded

Updated April 06, 2016 09:09 AM

Layer loadstart & loadend events in OpenLayers 3

Updated June 12, 2015 22:09 PM

GIS Day function ideas?

Updated October 24, 2018 23:22 PM