[gnome-maps/wip/mlundblad/handle-osm-urls: 1/2] mapWalker: Use initial zoom level when set



commit f920ddc581ce805240aeef7621ac1453ab97a94b
Author: Marcus Lundblad <ml update uu se>
Date:   Thu Jun 20 22:29:08 2019 +0200

    mapWalker: Use initial zoom level when set
    
    If the place set for the map walker has an
    initial desired zoom level set, use that.

 src/mapWalker.js | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/src/mapWalker.js b/src/mapWalker.js
index d433abb..aad724b 100644
--- a/src/mapWalker.js
+++ b/src/mapWalker.js
@@ -59,27 +59,29 @@ var MapWalker = GObject.registerClass({
 
     // Zoom to the maximal zoom-level that fits the place type
     zoomToFit() {
-        let zoom;
         if (this._boundingBox !== null && this._boundingBox.is_valid()) {
             this._view.zoom_level = this._view.max_zoom_level;
             this._view.ensure_visible(this._boundingBox, false);
         } else {
-            switch (this.place.place_type) {
-            case Geocode.PlaceType.STREET:
-                zoom = 16;
-                break;
-
-            case Geocode.PlaceType.TOWN:
-                zoom = 11;
-                break;
-
-            case Geocode.PlaceType.COUNTRY:
-                zoom = 6;
-                break;
-
-            default:
-                zoom = this._view.max_zoom_level;
-                break;
+            let zoom;
+
+            if (this.place.initialZoom) {
+                zoom = this.place.initialZoom;
+            } else {
+                switch (this.place.place_type) {
+                    case Geocode.PlaceType.STREET:
+                        zoom = 16;
+                        break;
+                    case Geocode.PlaceType.TOWN:
+                        zoom = 11;
+                        break;
+                    case Geocode.PlaceType.COUNTRY:
+                        zoom = 6;
+                        break;
+                    default:
+                        zoom = this._view.max_zoom_level;
+                        break;
+                }
             }
             this._view.zoom_level = zoom;
             this._view.center_on(this.place.location.latitude,


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