Call layer.getEvents before calling layer.onAdd (fix #3745)

This commit is contained in:
Yohan Boniface 2015-09-04 10:02:11 +02:00
parent ed0cf6e772
commit 61c07bd3e3

View File

@ -45,16 +45,16 @@ L.Layer = L.Evented.extend({
this._map = map;
this._zoomAnimated = map._zoomAnimated;
if (this.getEvents) {
map.on(this.getEvents(), this);
}
this.onAdd(map);
if (this.getAttribution && this._map.attributionControl) {
this._map.attributionControl.addAttribution(this.getAttribution());
}
if (this.getEvents) {
map.on(this.getEvents(), this);
}
this.fire('add');
map.fire('layeradd', {layer: this});
}