Making it so moveTo is only called once when creating a map with center and layers options. r=crschmidt (closes #3114)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11480 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-02-25 11:47:41 +00:00
parent 269749ec23
commit f7fcb86ee9
2 changed files with 17 additions and 1 deletions

View File

@@ -600,6 +600,14 @@ OpenLayers.Map = OpenLayers.Class({
// add any initial layers
if (options && options.layers) {
/**
* If you have set options.center, the map center property will be
* set at this point. However, since setCenter has not been caleld,
* addLayers gets confused. So we delete the map center in this
* case. Because the check below uses options.center, it will
* be properly set below.
*/
delete this.center;
this.addLayers(options.layers);
// set center (and optionally zoom)
if (options.center) {