From 87c966062cbc1c5d0b223c5d9106335cc44662fe Mon Sep 17 00:00:00 2001 From: Severin Opel Date: Thu, 12 Dec 2019 17:01:51 +0100 Subject: [PATCH] Map's cover state now updates every time cover is requested. --- lib/pixi/maps/map.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/pixi/maps/map.js b/lib/pixi/maps/map.js index 464dc06..c05a404 100644 --- a/lib/pixi/maps/map.js +++ b/lib/pixi/maps/map.js @@ -92,8 +92,6 @@ export class GeoMap { } } - - /** * Determines if the scatter covers the container. * @member {boolean} @@ -101,6 +99,14 @@ export class GeoMap { * @memberof GeoMap */ get cover() { + // For cloning we want to store the cover inside the map. + // But the scatter is responsible for the cover state. + // So we update the app's cover state every time + // we get the value. + if (this.image && this.image.scatter && this.image.scatter.cover != null) { + this._cover = this.image.scatter.cover + } + return this._cover } @@ -749,7 +755,7 @@ export class DeepZoomMap extends GeoMap { clone(container, scatter = null) { const map = new DeepZoomMap(this.mapProjection, this.tilesConfig, { alpha: this.alpha, - cover: this.image.scatter.cover, + cover: this.cover, debug: this.debug, startScale: this.startScale, minScale: this.minScale, @@ -833,7 +839,7 @@ export class ImageMap extends GeoMap { clone(container = null, scatter = null) { const map = new ImageMap(new PIXI.Sprite(this.sprite.texture), this.mapProjection, { alpha: this.alpha, - cover: this.image.cover, + cover: this.cover, debug: this.debug, startScale: this.startScale, minScale: this.minScale,