diff --git a/src/graphics/platform/Platform.ts b/src/graphics/platform/Platform.ts index a88626b..558d4a0 100644 --- a/src/graphics/platform/Platform.ts +++ b/src/graphics/platform/Platform.ts @@ -143,9 +143,8 @@ class smallDoorGraphic extends Container { this.addChild(this.labelGraphic); } draw(data: IPlatformData, stateData: IPlatformState, i: number): void { - const sonDoorAmount = data?.sonDoorAmount || 30; const start = - (-platformConsts.smallDoorWidth * sonDoorAmount) / 2 + + (-platformConsts.smallDoorWidth * data.sonDoorAmount) / 2 + platformConsts.smallDoorWidth * i; const smallDoorGraphic = this.smallDoorGraphic; const lineColor = PlatformColorEnum.doorGreen; @@ -158,7 +157,7 @@ class smallDoorGraphic extends Container { .moveTo(start, 0) .lineTo(start + platformConsts.smallDoorWidth - 3, 0); if (direction == 'down') { - this.labelGraphic.text = sonDoorAmount - i; + this.labelGraphic.text = data.sonDoorAmount - i; } else { this.labelGraphic.text = i + 1; } @@ -175,8 +174,7 @@ export class doorGraphic extends Container { super(); } draw(data: IPlatformData, stateData: IPlatformState): void { - const sonDoorAmount = data?.sonDoorAmount || 30; - for (let i = 0; i < sonDoorAmount; i++) { + for (let i = 0; i < data.sonDoorAmount; i++) { const smallDoor = new smallDoorGraphic(); smallDoor.draw(data, stateData, i); this.addChild(smallDoor); @@ -429,6 +427,7 @@ export class Platform extends JlGraphic { return this.datas.index + ''; } doRepaint(): void { + this.datas.sonDoorAmount = this.datas?.sonDoorAmount || 30; this.doorGraphic.clear(); if (this.datas.hasdoor) { this.doorGraphic.draw(this.datas, this.states);