[gnome-maps] mapLocation: Nicely handle case of area < 1
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] mapLocation: Nicely handle case of area < 1
- Date: Mon, 20 Jan 2014 16:11:04 +0000 (UTC)
commit de27989f162467cfb30b1fedce3053140ac0502e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Jan 20 16:09:38 2014 +0000
mapLocation: Nicely handle case of area < 1
If accuracy area is less than 1, we end-up showing '0 km2'. This patch
fixes that.
src/mapLocation.js | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/mapLocation.js b/src/mapLocation.js
index 616006a..16a0cc5 100644
--- a/src/mapLocation.js
+++ b/src/mapLocation.js
@@ -119,7 +119,12 @@ const MapLocation = new Lang.Class({
return _("Exact");
default:
let area = Math.PI * Math.pow(this.accuracy / 1000, 2);
- area = Math.floor(area);
+ log (this.accuracy + " => " + area);
+ if (area >= 1)
+ area = Math.floor(area);
+ else
+ area = Math.floor(area * 10) / 10;
+
return area.toString() + _(" kmĀ²");
}
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]