X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b5ca3b12d12c2e2dbcbf474bdb576622cacb184e..352d9365e4c2a70756d3cd2f14530a7f71201c36:/app/assets/javascripts/map.js.erb diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index fc2f955a8..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; } } @@ -220,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() {