diff options
author | Struan Donald <struan@exo.org.uk> | 2012-11-12 12:39:48 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-11-12 12:39:48 +0000 |
commit | e69eda1c4a8358d0f0f3e9c9365c92153c00090c (patch) | |
tree | f808b832bc03242e5400028acc40e19fcae7e870 /www/js | |
parent | 99891e3989a0d8c2cae8f6ebef935a5733da4e6b (diff) |
place crosshair over map centre so it is over our location
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/map-OpenLayers.js | 6 |
1 files changed, 4 insertions, 2 deletions
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() { |