From acdfa546a888c339c77931ff848c9a610ba68477 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Fri, 16 Mar 2012 10:41:54 +0100 Subject: [PATCH] added more precise distance values (at least three digits of precision) --- WebContent/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WebContent/utils.js b/WebContent/utils.js index 2f1ae41a2..ccccbb82c 100644 --- a/WebContent/utils.js +++ b/WebContent/utils.js @@ -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'; } }