diff options
author | Marcus Lundblad <ml@dfupdate.se> | 2022-12-07 22:19:04 +0100 |
---|---|---|
committer | Marcus Lundblad <ml@dfupdate.se> | 2022-12-31 10:05:30 +0100 |
commit | e72590cef18d0579d125662149cdd33bb44c269c (patch) | |
tree | 4af9c44cf5b3397654fb3e80ea55953c47c9d12c | |
parent | 2646610452a32211a03d4e875e91fcbc7d64bd94 (diff) | |
download | gnome-maps-wip/mlundblad/recreate-shapelaye-on-zoom.tar.gz |
shapeLayer: Recreate overlay layer on zoom changewip/mlundblad/recreate-shapelaye-on-zoom
This is a workaround to avoid blurred-out copies
of the lines from previous zoom levels.
-rw-r--r-- | src/shapeLayer.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/shapeLayer.js b/src/shapeLayer.js index d027b062..34a0d2d9 100644 --- a/src/shapeLayer.js +++ b/src/shapeLayer.js @@ -64,6 +64,16 @@ export class ShapeLayer extends GObject.Object { this._overlayLayer = new Shumate.MapLayer({ map_source: this._mapSource, viewport: this._mapView.map.viewport }); + this._zoomId = this._mapView.map.viewport.connect('notify::zoom-level', () => { + let oldOverlayLayer = this._overlayLayer; + + this._overlayLayer = + new Shumate.MapLayer({ map_source: this._mapSource, + viewport: this._mapView.map.viewport }); + this._overlayLayer.visible = this._visible; + this._mapView.map.add_layer(this._overlayLayer); + this._mapView.map.remove_layer(oldOverlayLayer); + }); } get bbox() { @@ -114,6 +124,7 @@ export class ShapeLayer extends GObject.Object { unload() { this._mapView.map.remove_layer(this._markerLayer); this._mapView.map.remove_layer(this._overlayLayer); + this._mapView.map.viewport.disconnect(this._zoomId); } } |