ember-leaflet icon indicating copy to clipboard operation
ember-leaflet copied to clipboard

Determining the parent of a clustered marker

Open jewe opened this issue 9 years ago • 1 comments

Is it currently possible to determine the parent of a clustered marker? This would be useful to e.g open the cluster for a selected marker.

There is this function - but i don't know how to access the marker object inside MarkerCollectionLayer (contentBinding):

markerClusterGroup.getVisibleParent(marker);

jewe avatar Sep 16 '15 07:09 jewe

I found a quite hacky solution by myself:

I use a lookup table in the controller to find the marker object by my internal id:

didCreateLayer:function(){
    this._updateLayerOnIconChange();
    this.get('controller').id2leaflet_id[this.content.id] = this._layer; // add to lookup table
},

Now i can open ever clustered marker:

var marker = this.id2leaflet_id[marker.id];
if (marker.__parent) {
    $(marker.__parent._icon).trigger("click");
}          

jewe avatar Sep 22 '15 09:09 jewe