File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments