From 34dfbef5a5c036b959e001a9572a8daa02386697 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 19 Sep 2006 17:08:43 +0000 Subject: [PATCH] fix for dynamic resizing git-svn-id: http://svn.openlayers.org/trunk/openlayers@1487 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 4e1d398261..14f8c96354 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -475,17 +475,20 @@ OpenLayers.Map.prototype = { for(var i=0; i < this.layers.length; i++) { this.layers[i].onMapResize(); } - - var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2); - - var zoom = this.getZoom(); - this.zoom = null; - this.setCenter(center, zoom); // store the new size this.size = newSize; // the div might have moved on the page, also this.events.element.offsets = null; + + if (this.baseLayer != null) { + var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2); + var centerLL = this.getLonLatFromViewPortPx(center); + var zoom = this.getZoom(); + this.zoom = null; + this.setCenter(this.getCenter(), zoom); + } + } },