From: Tom Hughes Date: Wed, 8 Apr 2009 23:14:50 +0000 (+0000) Subject: Tidy up new box code. X-Git-Tag: live~7616^2~35 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/7daa4f5d2bf9ad43f4e415a4f0b3f208fa414ffe?ds=sidebyside Tidy up new box code. --- diff --git a/public/javascripts/map.js b/public/javascripts/map.js index a52cd0a70..71edee56c 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -118,16 +118,16 @@ function addMarkerToMap(position, icon, description) { return marker; } -function addBoxToMap(boxbounds) { - box = new OpenLayers.Feature.Vector( - boxbounds.toGeometry().transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()) ); +function addBoxToMap(boxbounds) { + var geometry = boxbounds.toGeometry().transform(epsg4326, map.getProjectionObject()); + var box = new OpenLayers.Feature.Vector(geometry, {}, { + strokeWidth: 3, + strokeColor: '#0000ff', + fillOpacity: 0, + }); - box.style = { - 'strokeWidth': 3, - 'strokeColor': '#0000ff', - 'fillOpacity': 0, - }; vectors.addFeatures(box); + return box; }