[gnome-maps/wip/mlundblad/refresh-shapelayers: 3/3] mapView: Refresh shape layers when switching night mode and hybrid aerial



commit 8392437c9b2f57d2bc297a05708e00afbc306043
Author: Marcus Lundblad <ml update uu se>
Date:   Thu Jun 25 23:02:07 2020 +0200

    mapView: Refresh shape layers when switching night mode and hybrid aerial

 src/mapView.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 77f26f18..934b6d49 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -153,12 +153,11 @@ var MapView = GObject.registerClass({
         this._initLayers();
 
         this.setMapType(mapType);
+        this.shapeLayerStore = new Gio.ListStore(GObject.TYPE_OBJECT);
 
         if (Application.normalStartup)
             this._goToStoredLocation();
 
-        this.shapeLayerStore = new Gio.ListStore(GObject.TYPE_OBJECT);
-
         Application.geoclue.connect('location-changed',
                                     this._updateUserLocation.bind(this));
         Application.geoclue.connect('notify::state',
@@ -258,19 +257,25 @@ var MapView = GObject.registerClass({
 
     _onNightModeChanged() {
         if (this._mapType === MapType.STREET) {
+            let overlay_sources = this.view.get_overlay_sources();
+
             if (Application.settings.get('night-mode'))
                 this.view.map_source = MapSource.createStreetDarkSource();
             else
                 this.view.map_source = MapSource.createStreetSource();
+            overlay_sources.forEach((source) => this.view.add_overlay_source(source, 255));
         }
     }
 
     _onHybridAerialChanged() {
         if (this._mapType === MapType.AERIAL) {
+            let overlay_sources = this.view.get_overlay_sources();
+
             if (Application.settings.get('hybrid-aerial'))
                 this.view.map_source = MapSource.createHybridAerialSource();
             else
                 this.view.map_source = MapSource.createAerialSource();
+            overlay_sources.forEach((source) => this.view.add_overlay_source(source, 255));
         }
     }
 


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