Fixed map doctest.

This commit is contained in:
2019-11-11 12:34:43 +01:00
parent ef16f2b12b
commit 58cbd44a7b
7 changed files with 394 additions and 330 deletions
+27 -17
View File
@@ -163,26 +163,33 @@ export class MapLayer extends GeoLayer {
const min = visibility.min || 0
const max = visibility.max || Number.MAX_VALUE
if (zoom > min && zoom < max) {
this.elements.forEach(it => (it.visible = true))
// TODO
// Currently I dont know what elemnts was.
// We just log an error and resolve this on a later point.
if (this.elements) {
if (zoom > min && zoom < max) {
this.elements.forEach(it => (it.visible = true))
this.elements.forEach(it => {
const scale = 1 / it.parent.scale.x
this.elements.forEach(it => {
const scale = 1 / it.parent.scale.x
// it.children are poi groups
// it.children[0] is the poi group of the tübingen poi
// it.children[0].children are the text containers (not PIXI.Text), about 20 pieces
// it.children are poi groups
// it.children[0] is the poi group of the tübingen poi
// it.children[0].children are the text containers (not PIXI.Text), about 20 pieces
if (it.children.length > 0) {
it.children[0].children.forEach(poi => {
if (poi.children.length === 1) {
poi.scale.set(scale, scale)
}
})
}
})
} else {
this.elements.forEach(it => (it.visible = false))
if (it.children.length > 0) {
it.children[0].children.forEach(poi => {
if (poi.children.length === 1) {
poi.scale.set(scale, scale)
}
})
}
})
} else {
this.elements.forEach(it => (it.visible = false))
}
}else{
console.error("DEBUG: Elements was not defined.")
}
}
}
@@ -236,6 +243,8 @@ export class MapLayer extends GeoLayer {
useScatterAsContainer = true // If set to false, the normal container is used. This is necessary when using submaps and the container need to be a RigidContainer.*/
) {
if (map instanceof GeoMap) {
console.log("Change map to: " , map)
let oldMap = this.map
if (oldMap) oldMap.unload()
@@ -243,6 +252,7 @@ export class MapLayer extends GeoLayer {
this.map.load()
this.scatterContainer.addChild(this.map.image)
console.log(this.map.image.parent)
map.image.addChild(this.displayObject)
this.mapview.update(this.map)