Parcourir la source

Add scale control to maps (form & public). Fix #23

opi il y a 9 ans
Parent
commit
0ae1c0c9fa
2 fichiers modifiés avec 16 ajouts et 0 suppressions
  1. 8 0
      assets/form.js
  2. 8 0
      assets/map.js

+ 8 - 0
assets/form.js

@@ -14,6 +14,14 @@ $( document ).ready(function() {
         maxZoom: 18
     }).addTo(map);
 
+    // Add scale control
+    L.control.scale({
+        position: 'bottomleft',
+        metric: true,
+        imperial: false,
+        maxWidth: 150
+    }).addTo(map);
+
     // Create marker
     var marker = L.marker([defaults.lat,defaults.lng], {
         draggable: true

+ 8 - 0
assets/map.js

@@ -32,6 +32,14 @@ $( document ).ready(function() {
         maxZoom: 18
     }).addTo(map);
 
+    // Add scale control
+    L.control.scale({
+        position: 'bottomleft',
+        metric: true,
+        imperial: false,
+        maxWidth: 200
+    }).addTo(map);
+
     // Get JSON
     var GeoJsonPath = $('#map').data('json')
     $.getJSON(GeoJsonPath, function(data){