diff --git a/lib/OpenLayers/Layer/FixedZoomLevels.js b/lib/OpenLayers/Layer/FixedZoomLevels.js index be84a223d3..47ad10e0d3 100644 --- a/lib/OpenLayers/Layer/FixedZoomLevels.js +++ b/lib/OpenLayers/Layer/FixedZoomLevels.js @@ -213,25 +213,19 @@ OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({ * bounds of the current viewPort. */ getExtent: function () { - var extent = null; - - var size = this.map.getSize(); + var tl = this.getLonLatFromViewPortPx({ + x: 0, y: 0 + }); + var br = this.getLonLatFromViewPortPx({ + x: size.w, y: size.h + }); - var tlPx = new OpenLayers.Pixel(0,0); - var tlLL = this.getLonLatFromViewPortPx(tlPx); - - var brPx = new OpenLayers.Pixel(size.w, size.h); - var brLL = this.getLonLatFromViewPortPx(brPx); - - if ((tlLL != null) && (brLL != null)) { - extent = new OpenLayers.Bounds(tlLL.lon, - brLL.lat, - brLL.lon, - tlLL.lat); + if ((tl != null) && (br != null)) { + return new OpenLayers.Bounds(tl.lon, br.lat, br.lon, tl.lat); + } else { + return null; } - - return extent; }, /** diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 3514e857c7..fe374d9bae 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -1517,9 +1517,10 @@ OpenLayers.Map = OpenLayers.Class({ */ getCachedCenter: function() { if (!this.center && this.size) { - this.center = this.getLonLatFromViewPortPx( - new OpenLayers.Pixel(this.size.w / 2, this.size.h / 2) - ); + this.center = this.getLonLatFromViewPortPx({ + x: this.size.w / 2, + y: this.size.h / 2 + }); } return this.center; },