samedi 28 février 2015

Extend/change Leaflet Marker class to put DivIcon markers in another map pane


Leaflet uses different panes for different content. Markers are in the markerPane div and Popups are in the popupPane.


I find the DivIcon class a lot easier to use than the custom layer because of the range of options provided, but I'm missing one piece of functionality.


How can I extend the Marker class so that markers with regular Icons are placed in the markerPane, but markers with DivIcons are placed in the popupPane or in the leaflet-control-container? Or is there a better alternative solution? I realize this will be a lot more flexible in Leaflet 1.0, but I would love to make this work right now :)


basically, this is what I would like to add/change in the Marker class, but I don't know how to to the actual extension of the class.


if (addIcon) { if(this._icon.tagName == "DIV"){ panes.popupPane.appendChild(this._icon); } else{ panes.markerPane.appendChild(this._icon); } }


Any help would be much appreciated!





Aucun commentaire:

Enregistrer un commentaire