X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/4d91fe3dd95c1058cb8d24fd4c900223e30b9059..361906af9e5a7209af3f7006acbd117ed7b85e24:/app/assets/javascripts/map.js.erb diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index 8aa9868b3..4c1a849dc 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -81,6 +81,8 @@ function createMap(divName, options) { map.updateSize(); }); + $("#" + divName).trigger("initialised"); + return map; } @@ -106,13 +108,13 @@ function addMarkerToMap(position, icon, description) { return marker; } -function addObjectToMap(url, zoom, callback) { +function addObjectToMap(object, zoom, callback) { var layer = new OpenLayers.Layer.Vector("Objects", { strategies: [ new OpenLayers.Strategy.Fixed() ], protocol: new OpenLayers.Protocol.HTTP({ - url: url, + url: OSM.apiUrl(object), format: new OpenLayers.Format.OSM() }), style: { @@ -196,7 +198,6 @@ function openMapPopup(marker, description) { function closeMapPopup() { if (popup) { map.removePopup(popup); - delete popup; } } @@ -204,10 +205,6 @@ function removeMarkerFromMap(marker){ markers.removeMarker(marker); } -function removeBoxFromMap(box){ - vectors.removeFeature(box); -} - function proj(x) { return x.clone().transform(epsg4326, map.getProjectionObject()); } @@ -224,7 +221,7 @@ function setMapCenter(center, zoom) { } function getEventPosition(event) { - return map.getLonLatFromViewPortPx(event.xy).clone().transform(map.getProjectionObject(), epsg4326); + return unproj(map.getLonLatFromViewPortPx(event.xy)); } function getMapLayers() {