added more precise distance values (at least three digits of precision)
This commit is contained in:
+4
-1
@@ -46,7 +46,10 @@ function secondsToTime(seconds){
|
||||
// human readable distance
|
||||
function getDistanceWithUnit(distance){
|
||||
distance = parseInt(distance);
|
||||
if(distance >= 1000){ return (parseInt(distance/1000))+' ' + 'km'; }
|
||||
|
||||
if(distance >= 100000){ return (parseInt(distance/1000))+' ' + 'km'; }
|
||||
else if(distance >= 10000){ return (parseInt(distance/1000).toFixed(1))+' ' + 'km'; }
|
||||
else if(distance >= 1000){ return (parseFloat(distance/1000).toFixed(2))+' ' + 'km'; }
|
||||
else{ return distance+' ' + 'm'; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user