Removing layer dependency from geolayers and refactoring maps.

This commit is contained in:
2019-11-04 18:20:32 +01:00
parent 938b3e2f3c
commit ff0606d0a7
12 changed files with 1519 additions and 1340 deletions
+18 -17
View File
@@ -130,8 +130,10 @@ export class GeoMap {
}
unload() {
this.image.parent.removeChild(this.image)
this.image.scatter = null
if (this.image) {
if (this.image.parent) this.image.parent.removeChild(this.image)
this.image.scatter = null
}
}
/**
@@ -181,6 +183,17 @@ export class GeoMap {
this.image.scatter = scatter == null ? this.scatter : scatter
this.onLoad.call(this)
// Object.assign(this.image, {
// set scatter (value) {
// console.trace("Scatter set.")
// this._scatter = value
// },
// get scatter (){
// console.trace("Get Scatter.")
// return this._scatter
// }
// })
}
/**
@@ -264,21 +277,6 @@ export class GeoMap {
return _point
}
// /**
// * Appends the object to a PIXI container. This is important,
// * to notify the map, that it's parent has changed.
// *
// * If you want to use PIXI's addChild, make sure you call
// * appended right afterwards.
// *
// * @param {PIXI.Container} container
// * @returns Returns the map object to allow chaining.
// */
// appendTo(container) {
// container.addChild(this.image)
// return this.appended(container)
// }
get width() {
return this.image.scatter.width / this.image.scatter.scale
}
@@ -498,6 +496,8 @@ export class GeoMap {
return null
}
}
}
GeoMap.counter = 0
@@ -763,6 +763,7 @@ export class ImageMap extends GeoMap {
load(container = null, scatter = null) {
super.load(this.sprite, container, scatter)
console.log('LOADED')
this.image.alpha = this.alpha
this.image.interactive = true
}