[gnome-maps] MapView: set saner min-zoom-level on view



commit 27f146a265ef0caa431080ef2950d89befa99116
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed Dec 4 13:54:03 2013 +0100

    MapView: set saner min-zoom-level on view
    
    With a min-zoom-level of 0 the map will look kind of small in the
    Maps window.
    
    This patch tries to set a saner value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719841

 src/mapView.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 3292c44..7e388b1 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -50,6 +50,8 @@ const MapType = {
     TRANSIT: Champlain.MAP_SOURCE_OSM_TRANSPORT_MAP
 };
 
+const MapMinZoom = 2;
+
 const MapView = new Lang.Class({
     Name: 'MapView',
     Extends: GtkChamplain.Embed,
@@ -60,6 +62,7 @@ const MapView = new Lang.Class({
         this.actor = this.get_view();
         this.view = this.actor;
         this.view.set_zoom_level(3);
+        this.view.min_zoom_level = MapMinZoom;
         this.view.goto_animation_mode = Clutter.AnimationMode.LINEAR;
         this.view.set_reactive(true);
 
@@ -78,6 +81,13 @@ const MapView = new Lang.Class({
         this._userLocationLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
         this.view.add_layer(this._userLocationLayer);
 
+        // switching map type will set view min-zoom-level from map source
+        this.view.connect('notify::min-zoom-level', (function() {
+            if (this.view.min_zoom_level != MapMinZoom) {
+                this.view.min_zoom_level = MapMinZoom;
+            }
+        }).bind(this));
+
         this._factory = Champlain.MapSourceFactory.dup_default();
         this.setMapType(MapType.STREET);
 


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