fix: layers.layers ...

This commit is contained in:
cha0s 2021-01-16 11:50:26 -06:00
parent b22e531267
commit fbf9d954e3

View File

@ -10,20 +10,20 @@ export default class LayersView extends Container {
this.layerViews = {};
this.renderer = renderer;
this.layers.on('layerAdded', this.onLayerAdded, this);
for (let index = 0; index < layers.length; index++) {
this.onLayerAdded(layers[index], index);
for (let i = 0; i < this.layers.layers.length; i++) {
this.onLayerAdded(this.layers.layers[i], i);
}
this.layers.on('layerRemoved', this.onLayerRemoved, this);
}
onLayerAdded(layer, index) {
onLayerAdded(layer, i) {
const layerView = new LayerView(layer, this.renderer);
this.layerViews[index] = layerView;
this.layerViews[i] = layerView;
this.addChild(layerView);
}
onLayerRemoved(layer, index) {
const layerView = this.layerViews[index];
onLayerRemoved(layer, i) {
const layerView = this.layerViews[i];
if (!layerView) {
return;
}