From 61c07bd3e3d9a5a2bb4855ba81e1f368cc80090b Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 4 Sep 2015 10:02:11 +0200 Subject: [PATCH] Call layer.getEvents before calling layer.onAdd (fix #3745) --- src/layer/Layer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layer/Layer.js b/src/layer/Layer.js index c55f557a..5bdcea6c 100644 --- a/src/layer/Layer.js +++ b/src/layer/Layer.js @@ -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}); }