[gnome-maps/wip/mlundblad/coords-limit-fractions] placeEntry: Limit digits for raw coordinates



commit c6c1f7c55810c6f6194570d4463e0677405026ec
Author: Marcus Lundblad <ml update uu se>
Date:   Sun May 24 23:02:57 2020 +0200

    placeEntry: Limit digits for raw coordinates
    
    When setting a place without a name e.g. when
    using "Route from/to here", limit the number of
    digits after the decimal point, as more than
    approximatly one meter precision makes little sense.

 src/placeEntry.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/placeEntry.js b/src/placeEntry.js
index 1e22e39f..a1c4501a 100644
--- a/src/placeEntry.js
+++ b/src/placeEntry.js
@@ -65,12 +65,14 @@ var PlaceEntry = GObject.registerClass({
             return;
 
         if (p) {
-            if (p.name) {
+            if (p.name)
                 this._placeText = p.name;
-            } else
-                this._placeText = p.location.latitude + ', ' + p.location.longitude;
-        } else
+            else
+                this._placeText = '%.5f, %.5f'.format(p.location.latitude,
+                                                      p.location.longitude);
+        } else {
             this._placeText = '';
+        }
 
         this.text = this._placeText;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]