From e72590cef18d0579d125662149cdd33bb44c269c Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Wed, 7 Dec 2022 22:19:04 +0100 Subject: shapeLayer: Recreate overlay layer on zoom change This is a workaround to avoid blurred-out copies of the lines from previous zoom levels. --- src/shapeLayer.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); } } -- cgit v1.2.1