From 1be9e97489f852cedc9b6e3f65c487f2a68dab86 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 28 Sep 2012 14:53:09 +0200 Subject: [PATCH] Add attribution control by default --- examples/side-by-side.html | 5 ----- examples/side-by-side.js | 5 ----- examples/two-layers.html | 5 ----- examples/two-layers.js | 5 ----- src/ol/mapoptions.js | 3 +++ 5 files changed, 3 insertions(+), 20 deletions(-) diff --git a/examples/side-by-side.html b/examples/side-by-side.html index 7f84a0bee8..bd9f7ebd33 100644 --- a/examples/side-by-side.html +++ b/examples/side-by-side.html @@ -26,11 +26,6 @@
- - -
- - diff --git a/examples/side-by-side.js b/examples/side-by-side.js index 9196fc9bae..c696da15ab 100644 --- a/examples/side-by-side.js +++ b/examples/side-by-side.js @@ -4,7 +4,6 @@ goog.require('goog.debug.Logger.Level'); goog.require('ol.CoordinateFormat'); goog.require('ol.Map'); goog.require('ol.RendererHint'); -goog.require('ol.control.Attribution'); goog.require('ol.control.MousePosition'); goog.require('ol.interaction.Keyboard'); goog.require('ol.layer.TileLayer'); @@ -28,10 +27,6 @@ var domMap = new ol.Map(document.getElementById('domMap'), { zoom: 0 }); -domMap.getControls().push(new ol.control.Attribution({ - target: document.getElementById('attribution') -})); - domMap.getControls().push(new ol.control.MousePosition({ coordinateFormat: ol.CoordinateFormat.hdms, projection: ol.Projection.getFromCode('EPSG:4326'), diff --git a/examples/two-layers.html b/examples/two-layers.html index 50c31b640b..cb5c5e323b 100644 --- a/examples/two-layers.html +++ b/examples/two-layers.html @@ -22,11 +22,6 @@ - - -
-
-
diff --git a/examples/two-layers.js b/examples/two-layers.js index d0e1e51c88..bfba468fc8 100644 --- a/examples/two-layers.js +++ b/examples/two-layers.js @@ -3,7 +3,6 @@ goog.require('ol.Coordinate'); goog.require('ol.Map'); goog.require('ol.Projection'); goog.require('ol.RendererHint'); -goog.require('ol.control.Attribution'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.BingMaps'); goog.require('ol.source.TileJSON'); @@ -31,10 +30,6 @@ var webglMap = new ol.Map(document.getElementById('webglMap'), { zoom: 5 }); -webglMap.getControls().push(new ol.control.Attribution({ - target: document.getElementById('attribution') -})); - var domMap = new ol.Map(document.getElementById('domMap'), { renderer: ol.RendererHint.DOM }); diff --git a/src/ol/mapoptions.js b/src/ol/mapoptions.js index ba8b8c8da4..56b3617500 100644 --- a/src/ol/mapoptions.js +++ b/src/ol/mapoptions.js @@ -11,6 +11,7 @@ goog.require('ol.Constraints'); goog.require('ol.Projection'); goog.require('ol.ResolutionConstraint'); goog.require('ol.RotationConstraint'); +goog.require('ol.control.Attribution'); goog.require('ol.control.Zoom'); goog.require('ol.interaction.AltDragRotate'); goog.require('ol.interaction.DblClickZoom'); @@ -231,6 +232,8 @@ ol.MapOptions.createControls_ = function(mapOptionsLiteral) { var controls = new ol.Collection(); + controls.push(new ol.control.Attribution({})); + var zoomDelta = goog.isDef(mapOptionsLiteral.zoomDelta) ? mapOptionsLiteral.zoomDelta : 4; controls.push(new ol.control.Zoom({