X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e4ef507c5c56ab1f700a04c099f6938a143f836f..1ae4483c6939a93f96eb6cdb02ac38c0f36479ae:/app/assets/javascripts/browse.js?ds=sidebyside diff --git a/app/assets/javascripts/browse.js b/app/assets/javascripts/browse.js index e98aa2ed6..995f0d12d 100644 --- a/app/assets/javascripts/browse.js +++ b/app/assets/javascripts/browse.js @@ -21,16 +21,14 @@ $(document).ready(function () { return false; } - var map = createMap("small_map", { - controls: [ new OpenLayers.Control.Navigation() ] - }); + var map = createMap("small_map"); var params = $("#small_map").data(); if (params.type == "changeset") { - var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat); - var centre = bbox.getCenterLonLat(); + var bbox = L.latLngBounds([params.minlat, params.minlon], + [params.maxlat, params.maxlon]); - map.zoomToExtent(proj(bbox)); + map.fitBounds(bbox); addBoxToMap(bbox); $("#loading").hide(); @@ -40,7 +38,8 @@ $(document).ready(function () { return remoteEditHandler(bbox); }); - updatelinks(centre.lon, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat); + var centre = bbox.getCenter(); + updatelinks(centre.lng, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat); } else { $("#object_larger_map").hide(); $("#object_edit").hide(); @@ -56,10 +55,6 @@ $(document).ready(function () { $("#browse_map .geolink").show(); if (extent) { - extent.transform(map.getProjectionObject(), map.displayProjection); - - var centre = extent.getCenterLonLat(); - $("a.bbox[data-editor=remote]").click(function () { return remoteEditHandler(extent); }); @@ -71,7 +66,8 @@ $(document).ready(function () { $("#object_larger_map").show(); $("#object_edit").show(); - updatelinks(centre.lon, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, params.type, params.id); + var centre = extent.getCenter(); + updatelinks(centre.lng, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, object); } else { $("#small_map").hide(); }