Map's cover state now updates every time cover is requested.

This commit is contained in:
Severin Opel 2019-12-12 17:01:51 +01:00
parent d7f867f1a6
commit 87c966062c

View File

@ -92,8 +92,6 @@ export class GeoMap {
} }
} }
/** /**
* Determines if the scatter covers the container. * Determines if the scatter covers the container.
* @member {boolean} * @member {boolean}
@ -101,6 +99,14 @@ export class GeoMap {
* @memberof GeoMap * @memberof GeoMap
*/ */
get cover() { 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 return this._cover
} }
@ -749,7 +755,7 @@ export class DeepZoomMap extends GeoMap {
clone(container, scatter = null) { clone(container, scatter = null) {
const map = new DeepZoomMap(this.mapProjection, this.tilesConfig, { const map = new DeepZoomMap(this.mapProjection, this.tilesConfig, {
alpha: this.alpha, alpha: this.alpha,
cover: this.image.scatter.cover, cover: this.cover,
debug: this.debug, debug: this.debug,
startScale: this.startScale, startScale: this.startScale,
minScale: this.minScale, minScale: this.minScale,
@ -833,7 +839,7 @@ export class ImageMap extends GeoMap {
clone(container = null, scatter = null) { clone(container = null, scatter = null) {
const map = new ImageMap(new PIXI.Sprite(this.sprite.texture), this.mapProjection, { const map = new ImageMap(new PIXI.Sprite(this.sprite.texture), this.mapProjection, {
alpha: this.alpha, alpha: this.alpha,
cover: this.image.cover, cover: this.cover,
debug: this.debug, debug: this.debug,
startScale: this.startScale, startScale: this.startScale,
minScale: this.minScale, minScale: this.minScale,