From 75458d331a4a547e8a1935355f23c57ec0437b02 Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 27 Mar 2019 22:27:58 -0500 Subject: [PATCH] chore: simplify tiles size state --- packages/topdown/tiles.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/topdown/tiles.js b/packages/topdown/tiles.js index c356ff9..f81b456 100644 --- a/packages/topdown/tiles.js +++ b/packages/topdown/tiles.js @@ -16,13 +16,15 @@ export class Tiles extends decorate(class {}) { constructor() { super(); this.data = I.List(); - this._sizeState = I.List(); this._state = I.Map(); } acceptStateChange(change) { - if (change.size) { - this.size = change.size; + if (change.width) { + this.width = change.width; + } + if (change.height) { + this.height = change.height; } if (change.data) { const oldData = this.data; @@ -96,8 +98,8 @@ export class Tiles extends decorate(class {}) { } tick(elapsed) { - this._sizeState = this._sizeState.set(0, this.width).set(1, this.height); - this._state = this._state.set('size', this._sizeState); + this._state = this._state.set('width', this.width); + this._state = this._state.set('height', this.height); this._state = this._state.set('data', this.data); }