diff --git a/src/ol/map.js b/src/ol/map.js index b667bf470f..18a15bad87 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -185,14 +185,6 @@ ol.Map = function(container, mapOptionsLiteral) { */ this.controls_ = mapOptions.controls; - this.controls_.forEach( - /** - * @param {ol.control.Control} control Control. - */ - function(control) { - control.setMap(this); - }, this); - goog.events.listen(this.controls_, ol.CollectionEventType.ADD, this.handleControlsAdd_, false, this); goog.events.listen(this.controls_, ol.CollectionEventType.REMOVE, @@ -225,6 +217,14 @@ ol.Map = function(container, mapOptionsLiteral) { this.handleBrowserWindowResize(); + this.controls_.forEach( + /** + * @param {ol.control.Control} control Control. + */ + function(control) { + control.setMap(this); + }, this); + }; goog.inherits(ol.Map, ol.Object);