How do I detect a click on a layer and find out information about the layer that was clicked?
Currently I can do the usual binding a popup and adding a click handler on the layer:
L.geoJson(data.streets, { onEachFeature: function(feature, featureLayer) { featureLayer.bindPopup(feature.properties.name); featureLayer.on('click', function(e) { console.log('Layer clicked!', e); }); ...However the click handler on the layer doesn't give me any information about the layer, just the following:
containerPoint: o.Pointlatlng: o.LatLng { lat: 50.804443085898185, lng: -1.089920997619629 }__proto__: ObjectlayerPoint: o.PointoriginalEvent: MouseEventtarget: etype: "click"__proto__: ObjectHow can I get a reference to the layer it's clicking?
أكثر...
Currently I can do the usual binding a popup and adding a click handler on the layer:
L.geoJson(data.streets, { onEachFeature: function(feature, featureLayer) { featureLayer.bindPopup(feature.properties.name); featureLayer.on('click', function(e) { console.log('Layer clicked!', e); }); ...However the click handler on the layer doesn't give me any information about the layer, just the following:
containerPoint: o.Pointlatlng: o.LatLng { lat: 50.804443085898185, lng: -1.089920997619629 }__proto__: ObjectlayerPoint: o.PointoriginalEvent: MouseEventtarget: etype: "click"__proto__: ObjectHow can I get a reference to the layer it's clicking?
أكثر...