[GIS] Leaflet – click on map object will trigger click on another map object

leaflet

i have this situation:

enter image description here

I want that clicking on the circle (buffer) around the marker will trigger a click on the marker.

This is where im creating the circle around the marker:

L.geoJSON(buffer).addTo(this.map).on("click", (e)=> marker.fire("click")

But unfortunately it doesnt work. The click on the circle is triggered but not triggering the click on the marker.

Any suggestions?

Edit: this is where im trying to attach the event:

this.drawnItems = L.featureGroup().addTo(this.map)
let currentLayer = this.drawnItems[index];

let bufMapObject = L.geoJSON(buffer).addTo(this.map).on("click", (e) => {
                console.log(currentLayer)
                currentLayer.fire("click")
            });

The output of console.log(currentLayer) is:
enter image description here

Best Answer

It is hard to say wihout the rest of the code why your code is not working. I used Leaflet geoJSON example http://leafletjs.com/examples/geojson/example.html for testing, just added one marker. Here is the code that works:

var myMarker = L.marker([39.744, -105.0043]).bindPopup('My marker.');
myMarker.addTo(map);

L.geoJSON(campus).addTo(map).on('click', function(e) {myMarker.fire('click');} );