X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d9f3ceed958a1d39b17bc4719b59ef8a226ace70..c71209507bbc80c3e90006e67b93388b61fd0336:/app/assets/javascripts/index.js?ds=sidebyside diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 0ec9b388c..029c0bfd1 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -51,30 +51,34 @@ $(document).ready(function () { map.noteLayer = new L.LayerGroup({code: 'N'}); map.dataLayer = new L.OSM.DataLayer(null); - $("#map").on("resized", function () { + $("#sidebar").on("opened closed", function () { map.invalidateSize(); }); - L.OSM.zoom({position: 'topright'}) + var position = $('html').attr('dir') === 'rtl' ? 'topleft' : 'topright'; + + L.OSM.zoom({position: position}) .addTo(map); - L.control.locate({position: 'topright'}) + L.control.locate({position: position}) .addTo(map); - var sidebar = L.OSM.sidebar('#map-ui'); + var sidebar = L.OSM.sidebar('#map-ui') + .addTo(map); L.OSM.layers({ - position: 'topright', + position: position, layers: layers, sidebar: sidebar }).addTo(map); L.OSM.key({ - position: 'topright', + position: position, sidebar: sidebar }).addTo(map); L.OSM.share({ + position: position, getShortUrl: getShortUrl, getUrl: getUrl, sidebar: sidebar, @@ -82,7 +86,7 @@ $(document).ready(function () { }).addTo(map); L.OSM.note({ - position: 'topright', + position: position, sidebar: sidebar }).addTo(map); @@ -135,8 +139,6 @@ $(document).ready(function () { addObjectToMap(params.object, map, { zoom: params.object_zoom }); } - handleResize(); - $("body").on("click", "a.set_position", setPositionLink(map)); $("a[data-editor=remote]").click(function(e) { @@ -148,8 +150,6 @@ $(document).ready(function () { remoteEditHandler(map.getBounds()); } - $(window).resize(handleResize); - $("#search_form").submit(submitSearch(map));