[gnome-maps/wip/mlundblad/refresh-shapelayers: 2/2] mapView: Refresh shape layers when switching map type



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

    mapView: Refresh shape layers when switching map type

 src/mapView.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 77f26f18..d2e4bf38 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -152,13 +152,12 @@ var MapView = GObject.registerClass({
         this.view = this._initView();
         this._initLayers();
 
+        this.shapeLayerStore = new Gio.ListStore(GObject.TYPE_OBJECT);
         this.setMapType(mapType);
 
         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',
@@ -439,6 +438,7 @@ var MapView = GObject.registerClass({
         }
 
         overlay_sources.forEach((source) => this.view.add_overlay_source(source, 255));
+        this._refreshShapeLayers();
 
         this.emit("map-type-changed", mapType);
     }
@@ -474,6 +474,11 @@ var MapView = GObject.registerClass({
         return ret;
     }
 
+    _refreshShapeLayers() {
+        for (let i = 0; i < this.shapeLayerStore.get_n_items(); i++)
+            this.shapeLayerStore.get_item(i).refresh();
+    }
+
     removeShapeLayer(shapeLayer) {
         shapeLayer.unload();
         let i = this._findShapeLayerIndex(shapeLayer.file);


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