]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.map.js.erb
Permalinks for directions
[rails.git] / app / assets / javascripts / leaflet.map.js.erb
index 6c84bef55f414c95952972133c13e7faaecffdb9..6f7d7754fd360887debbe5c2b230d3ba61295d7d 100644 (file)
@@ -36,7 +36,7 @@ L.OSM.Map = L.Map.extend({
         name: I18n.t("javascripts.map.base.transport_map")
       }),
       new L.OSM.MapQuestOpen({
-        attribution: copyright + ". Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>",
+        attribution: copyright + ". Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='https://developer.mapquest.com/content/osm/mq_logo.png'>",
         code: "Q",
         keyid: "mapquest",
         name: I18n.t("javascripts.map.base.mapquest")
@@ -91,7 +91,7 @@ L.OSM.Map = L.Map.extend({
   },
 
   getUrl: function(marker) {
-    var precision = zoomPrecision(this.getZoom()),
+    var precision = OSM.zoomPrecision(this.getZoom()),
         params = {};
 
     if (marker && this.hasLayer(marker)) {
@@ -148,6 +148,11 @@ L.OSM.Map = L.Map.extend({
     }
 
     var params = {};
+    var layers = this.getLayersCode().replace('M', '');
+
+    if (layers) {
+      params.layers = layers;
+    }
 
     if (marker && this.hasLayer(marker)) {
       params.m = '';
@@ -237,6 +242,19 @@ L.OSM.Map = L.Map.extend({
   setState: function(state, options) {
     if (state.center) this.setView(state.center, state.zoom, options);
     this.updateLayers(state.layers);
+  },
+
+  setSidebarOverlaid: function(overlaid) {
+    if (overlaid && !$("#content").hasClass("overlay-sidebar")) {
+      $("#content").addClass("overlay-sidebar");
+      this.invalidateSize({pan: false})
+        .panBy([-350, 0], {animate: false});
+    } else if (!overlaid && $("#content").hasClass("overlay-sidebar")) {
+      this.panBy([350, 0], {animate: false});
+      $("#content").removeClass("overlay-sidebar");
+      this.invalidateSize({pan: false});
+    }
+    return this;
   }
 });