accept name in Layer getPane, make Marker panes configurable

This commit is contained in:
Vladimir Agafonkin 2013-12-06 14:34:04 +02:00
parent 7f03570b8d
commit d53bc0e4f8
2 changed files with 7 additions and 6 deletions

View File

@ -63,9 +63,10 @@ L.Layer = L.Class.extend({
this._map = null; this._map = null;
}, },
getPane: function () { getPane: function (name) {
// TODO make pane if not present // 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];
} }
}); });

View File

@ -5,6 +5,8 @@
L.Marker = L.Layer.extend({ L.Marker = L.Layer.extend({
options: { options: {
pane: 'markerPane',
icon: new L.Icon.Default(), icon: new L.Icon.Default(),
// title: '', // title: '',
// alt: '', // alt: '',
@ -147,13 +149,11 @@ L.Marker = L.Layer.extend({
} }
var panes = this._map._panes;
if (addIcon) { if (addIcon) {
panes.markerPane.appendChild(this._icon); this.getPane().appendChild(this._icon);
} }
if (newShadow && addShadow) { if (newShadow && addShadow) {
panes.shadowPane.appendChild(this._shadow); this.getPane('shadowPane').appendChild(this._shadow);
} }
}, },