Call layer.getEvents before calling layer.onAdd (fix #3745)
This commit is contained in:
parent
ed0cf6e772
commit
61c07bd3e3
@ -45,16 +45,16 @@ L.Layer = L.Evented.extend({
|
|||||||
this._map = map;
|
this._map = map;
|
||||||
this._zoomAnimated = map._zoomAnimated;
|
this._zoomAnimated = map._zoomAnimated;
|
||||||
|
|
||||||
|
if (this.getEvents) {
|
||||||
|
map.on(this.getEvents(), this);
|
||||||
|
}
|
||||||
|
|
||||||
this.onAdd(map);
|
this.onAdd(map);
|
||||||
|
|
||||||
if (this.getAttribution && this._map.attributionControl) {
|
if (this.getAttribution && this._map.attributionControl) {
|
||||||
this._map.attributionControl.addAttribution(this.getAttribution());
|
this._map.attributionControl.addAttribution(this.getAttribution());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getEvents) {
|
|
||||||
map.on(this.getEvents(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fire('add');
|
this.fire('add');
|
||||||
map.fire('layeradd', {layer: this});
|
map.fire('layeradd', {layer: this});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user