diff --git a/src/layer/Layer.js b/src/layer/Layer.js index f99012a2..20cf3df9 100644 --- a/src/layer/Layer.js +++ b/src/layer/Layer.js @@ -63,9 +63,10 @@ L.Layer = L.Class.extend({ this._map = null; }, - getPane: function () { + getPane: function (name) { // TODO make pane if not present - return this._map._panes[this.options.pane]; + var paneName = name ? this.options[name] || name : this.options.pane; + return this._map._panes[paneName]; } }); diff --git a/src/layer/marker/Marker.js b/src/layer/marker/Marker.js index dcec27de..876dedf0 100644 --- a/src/layer/marker/Marker.js +++ b/src/layer/marker/Marker.js @@ -5,6 +5,8 @@ L.Marker = L.Layer.extend({ options: { + pane: 'markerPane', + icon: new L.Icon.Default(), // title: '', // alt: '', @@ -147,13 +149,11 @@ L.Marker = L.Layer.extend({ } - var panes = this._map._panes; - if (addIcon) { - panes.markerPane.appendChild(this._icon); + this.getPane().appendChild(this._icon); } if (newShadow && addShadow) { - panes.shadowPane.appendChild(this._shadow); + this.getPane('shadowPane').appendChild(this._shadow); } },