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
-30
View File
@@ -1,6 +1,5 @@
import PIXIApp from '../app.js'
import { CoordinateDisplay } from '../../../../js/display.js'
import { DOMLayer, PIXILayer } from '../../../../src/layers/js/layer.js'
import { MapLayer } from './geolayer.js'
import { RigidScatterContainer } from './scatter.js'
import { EventHandler } from './utils.js'
@@ -111,11 +110,6 @@ export default class MapApp extends PIXIApp {
if (element.refreshFps) fpsDisplay = element
})
this.pixiLayer = new PIXILayer({
name: 'Pixi Root',
container: this.scene
})
this._setupMapLayer()
this.ui = new PIXI.Container()
@@ -203,9 +197,7 @@ export default class MapApp extends PIXIApp {
}
addMap(key, map) {
if (this.mapLayer != null) this.mapLayer.mapList.add(key, map)
if (this.mapList) this.mapList.add(key, map)
//This is necessary as there is a state, when the mapList
else console.error('Cannot access mapLayer. It was not initialized yet.')
}
@@ -224,19 +216,6 @@ export default class MapApp extends PIXIApp {
lastMap.flushHandlers()
}
/**
* TODO: A problem is that the map layer has no container
* on its own and it lives in the ScatterContainer.
* Here we guarantee, that the layer order is as it
* is defined in the layers.
*/
// this.pixiLayer.layers.forEach(layer => {
// if (layer !== this.mapLayer) {
// layer.parent.container.removeChild(layer.container)
// layer.parent.container.addChild(layer.container)
// }
// })
this.map.onTransform.add(this.transformed.bind(this))
this.transformed()
@@ -270,15 +249,6 @@ export default class MapApp extends PIXIApp {
this.overlayElements.set(layer, obj)
}
place(layer) {
if (layer instanceof PIXILayer) {
this.pixiLayer.place(layer)
} else if (layer instanceof DOMLayer) {
this.domLayer.place(layer)
} else {
console.error('Could not add layer to ', this, layer)
}
}
addMapOverlay(layer) {
this.mapLayer.place(layer)