Skip to content

Commit ac7e6c6

Browse files
xssfoxTheSkorm
authored andcommitted
fix for #398 imperial units on leaflet
1 parent f127d15 commit ac7e6c6

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

js/app.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,18 @@ $(window).ready(function() {
850850
else focusVehicle(null, true);
851851
break;
852852
case "opt_imperial":
853+
if (map_scale){
854+
map_scale.remove()
855+
}
856+
// we need to remove and add the zoom controls so they end up in the same position
857+
zoom_controls.remove()
858+
if (on) {
859+
map_scale = L.control.scale({position:'bottomright', imperial:true, metric:false}).addTo(map);
860+
} else {
861+
map_scale = L.control.scale({position:'bottomright', imperial:false}).addTo(map);
862+
}
863+
zoom_controls.addTo(map);
864+
853865
case "opt_haxis_hours":
854866
refreshUI();
855867
break;

js/sondehub.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,10 +868,15 @@ function load() {
868868
L.control.status({ position: 'bottomright' }).addTo(map);
869869

870870
// scale (would be better if integrated into attirbution bar)
871-
L.control.scale({position:'bottomright', imperial:false}).addTo(map);
871+
if (offline.get('opt_imperial')){
872+
map_scale = L.control.scale({position:'bottomright', imperial:true, metric:false}).addTo(map);
873+
} else {
874+
map_scale = L.control.scale({position:'bottomright', imperial:false}).addTo(map);
875+
}
876+
872877

873878
// zoom controls
874-
new L.Control.Zoom({ position: 'bottomright' }).addTo(map);
879+
zoom_controls = new L.Control.Zoom({ position: 'bottomright' }).addTo(map);
875880

876881
// map selector
877882
layers = L.control.layers(baseMaps, null, {position: "topleft"}).addTo(map);

0 commit comments

Comments
 (0)