From 0e435b54838814a812af13db18826949863d0799 Mon Sep 17 00:00:00 2001 From: fredj Date: Thu, 26 Jan 2012 09:09:05 +0100 Subject: [PATCH] Simplify moveGriddedTiles code. Saves 3 unnecessary instances creation and 6 parseFloat calls. --- lib/OpenLayers/Layer/Grid.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 1e5b0c9d89..0355f2b7d4 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -983,14 +983,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { var buffer = this.buffer || 1; var scale = this.getResolutionScale(); while(true) { - var tlLayer = this.grid[0][0].position.clone(); - tlLayer.x *= scale; - tlLayer.y *= scale; - tlLayer = tlLayer.add(parseInt(this.div.style.left, 10), - parseInt(this.div.style.top, 10)); - var offsetX = parseInt(this.map.layerContainerDiv.style.left); - var offsetY = parseInt(this.map.layerContainerDiv.style.top); - var tlViewPort = tlLayer.add(offsetX, offsetY); + var tlViewPort = { + x: (this.grid[0][0].position.x * scale) + + parseInt(this.div.style.left, 10) + + parseInt(this.map.layerContainerDiv.style.left), + y: (this.grid[0][0].position.y * scale) + + parseInt(this.div.style.top, 10) + + parseInt(this.map.layerContainerDiv.style.top) + }; var tileSize = { w: this.tileSize.w * scale, h: this.tileSize.h * scale