refactor: index

This commit is contained in:
cha0s 2021-03-15 05:52:56 -05:00
parent dff0e02e46
commit 29b99fee71
2 changed files with 11 additions and 7 deletions

View File

@ -13,7 +13,7 @@ export default (latus) => {
); );
return class Layer extends decorate(JsonResource) { return class Layer extends decorate(JsonResource) {
#s13nId; #index;
constructor() { constructor() {
super(); super();
@ -45,6 +45,14 @@ export default (latus) => {
return this.entityList.findEntity(uuid); return this.entityList.findEntity(uuid);
} }
get index() {
return this.#index;
}
set index(index) {
this.#index = index;
}
indexAt(position) { indexAt(position) {
return this.tiles.indexAt(position); return this.tiles.indexAt(position);
} }
@ -95,11 +103,7 @@ export default (latus) => {
} }
get s13nId() { get s13nId() {
return this.#s13nId; return this.#index;
}
set s13nId(s13nId) {
this.#s13nId = s13nId;
} }
setEntityList(entityList) { setEntityList(entityList) {

View File

@ -24,7 +24,7 @@ export default (latus) => {
addLayer(layer) { addLayer(layer) {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
layer.s13nId = this.layers.length; layer.index = this.layers.length;
this.startSynchronizing(layer); this.startSynchronizing(layer);
layer.on('entityAdded', this.onEntityAddedToLayers, this); layer.on('entityAdded', this.onEntityAddedToLayers, this);
layer.on('entityRemoved', this.onEntityRemovedFromLayers, this); layer.on('entityRemoved', this.onEntityRemovedFromLayers, this);