[gnome-maps] Restore map overlays when changing primary source



commit b90cf9b11aa72a1b9bdbb4e5192fb596ed1f8799
Author: Hashem Nasarat <hashem riseup net>
Date:   Mon Dec 28 14:37:06 2015 -0500

    Restore map overlays when changing primary source
    
    Changing the primary map source will also clear all secondary map
    sources. With this change, when the map is toggled between satellite and
    mapquest sources, any loaded overlays (like a GeoJSON layer) will
    continue be shown.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759935

 src/mapView.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 3f85a37..242ceb8 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -161,6 +161,8 @@ const MapView = new Lang.Class({
         if (this.view.map_source.id === mapType)
             return;
 
+        let overlay_sources = this.view.get_overlay_sources();
+
         if (mapType !== MapType.LOCAL) {
             let source = this._factory.create_cached_source(mapType);
             this.view.map_source = source;
@@ -184,6 +186,10 @@ const MapView = new Lang.Class({
                 Application.notificationManager.showMessage(e.message);
             }
         }
+
+        overlay_sources.forEach((function(overlay) {
+            this.view.add_overlay_source(overlay, 255);
+        }).bind(this));
     },
 
     openGeoJSON: function(file) {


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