From e69eda1c4a8358d0f0f3e9c9365c92153c00090c Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 12 Nov 2012 12:39:48 +0000 Subject: place crosshair over map centre so it is over our location --- www/js/map-OpenLayers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'www/js/map-OpenLayers.js') diff --git a/www/js/map-OpenLayers.js b/www/js/map-OpenLayers.js index 5ef6603..4649b90 100644 --- a/www/js/map-OpenLayers.js +++ b/www/js/map-OpenLayers.js @@ -303,8 +303,10 @@ OpenLayers.Control.Crosshairs.prototype = getIdealPosition: function() { this.map.updateSize(); var mapSize = this.map.getSize(); - return new OpenLayers.Pixel((mapSize.w / 2) - (this.imageSize.w / 2), - (2 * mapSize.h / 5) - (this.imageSize.h / 2)); + var center = this.map.getCenter(); + var px = this.map.getPixelFromLonLat( center ); + return new OpenLayers.Pixel( px.x - ( this.imageSize.w / 2 ), + px.y - ( this.imageSize.h / 2 ) ); }, getMapPosition: function() { -- cgit v1.2.3