[gnome-maps] mapLocation: use placeType in zoomToFit



commit 6cfae29ed59ae3cd69aa6b9e3935f21f0108e929
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed Jan 29 13:55:04 2014 +0100

    mapLocation: use placeType in zoomToFit
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722865

 src/mapLocation.js |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/src/mapLocation.js b/src/mapLocation.js
index 0fd169b..1ce82fb 100644
--- a/src/mapLocation.js
+++ b/src/mapLocation.js
@@ -106,21 +106,31 @@ const MapLocation = new Lang.Class({
         this.goTo(animate);
     },
 
-    // Zoom to the maximal zoom-level that fits the accuracy circle
+    // Zoom to the maximal zoom-level that fits the place type
     zoomToFit: function() {
         let zoom;
-        if (this.accuracy === Geocode.LOCATION_ACCURACY_UNKNOWN)
-            zoom = 11; // Accuracy is usually city-level when unknown
-        else if (this.accuracy <= Geocode.LOCATION_ACCURACY_STREET)
+
+        switch (this.placeType) {
+        case Geocode.PlaceType.STREET:
             zoom = 16;
-        else if (this.accuracy <= Geocode.LOCATION_ACCURACY_CITY)
+            break;
+
+        case Geocode.PlaceType.CITY:
             zoom = 11;
-        else if (this.accuracy <= Geocode.LOCATION_ACCURACY_REGION)
+            break;
+
+        case Geocode.PlaceType.REGION:
             zoom = 10;
-        else if (this.accuracy <= Geocode.LOCATION_ACCURACY_COUNTRY)
+            break;
+
+        case Geocode.PlaceType.COUNTRY:
             zoom = 6;
-        else
-            zoom = 3;
+            break;
+
+        default:
+            zoom = 11;
+            break;
+        }
         this._view.set_zoom_level(zoom);
     },
 


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