From d2d3eb075f182441762c055f12e908f3793f4b57 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Wed, 28 Jun 2006 12:38:05 +0000 Subject: [PATCH] We round these values to four decimale places: This saves us on rounding errors on the client-side, which could theoretically increase our cache size when we hit them, and in the case of the left/top values, this also makes sure that we get the closest pixel value, not the integer of it -- this is important when we get around to requesting the tiles, since otherwise we end up a pixel off, and then we don't get our images back. git-svn-id: http://svn.openlayers.org/trunk/openlayers@821 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/KaMap.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Layer/KaMap.js b/lib/OpenLayers/Layer/KaMap.js index 37291d6c57..2c8e00e2ea 100644 --- a/lib/OpenLayers/Layer/KaMap.js +++ b/lib/OpenLayers/Layer/KaMap.js @@ -42,11 +42,11 @@ OpenLayers.Layer.KaMap.prototype = var zoom = this.map.getZoom(); var maxRes = this.map.maxResolution; var mapRes = this.map.getResolution(); - var scale = (((this.tileSize.w * this.map.maxResolution * this.resolution) * (this.scales[this.units])) / this.tileSize.w) / Math.pow(2, zoom); + var scale = Math.round( (((this.tileSize.w * this.map.maxResolution * this.resolution) * (this.scales[this.units])) / this.tileSize.w) / Math.pow(2, zoom) * 10000 ) / 10000; var cellSize = new OpenLayers.Size(mapRes*this.tileSize.w, mapRes*this.tileSize.h); - var pX = Math.floor(((bounds.left) / cellSize.w) * this.tileSize.w); - var pY = -Math.floor(((bounds.top) / cellSize.h) * this.tileSize.h); + var pX = Math.round(((bounds.left) / cellSize.w) * this.tileSize.w); + var pY = -Math.round(((bounds.top) / cellSize.h) * this.tileSize.h); var url = this.getFullRequestString( { t: pY, l: pX,