diff --git a/lib/OpenLayers/Layer/WMS/Untiled.js b/lib/OpenLayers/Layer/WMS/Untiled.js index 23e1cea2fd..9536e0aa64 100644 --- a/lib/OpenLayers/Layer/WMS/Untiled.js +++ b/lib/OpenLayers/Layer/WMS/Untiled.js @@ -125,7 +125,7 @@ OpenLayers.Layer.WMS.Untiled.prototype = //clear out the old tile if (this.tile) { - OpenLayers.Util.clearArray(this.tile); + this.tile.clear(); } //determine new tile bounds @@ -150,6 +150,11 @@ OpenLayers.Layer.WMS.Untiled.prototype = var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top); var pos = this.map.getLayerPxFromLonLat(ul); + if ( this.tile && !this.tile.size.equals(tileSize)) { + this.tile.destroy(); + this.tile = null; + } + if (!this.tile) { this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds, url, tileSize); diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 2116c2f9bf..11f69950bc 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -786,8 +786,10 @@ OpenLayers.Map.prototype = { var originPx = this.getViewPortPxFromLonLat(this.layerContainerOrigin); var newPx = this.getViewPortPxFromLonLat(lonlat); - this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px"; - this.layerContainerDiv.style.top = (originPx.y - newPx.y) + "px"; + if ((originPx != null) && (newPx != null)) { + this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px"; + this.layerContainerDiv.style.top = (originPx.y - newPx.y) + "px"; + } }, /**