From 43dc054fed649abbf772aa60919dcb38c8174d6a Mon Sep 17 00:00:00 2001 From: duckietm Date: Thu, 30 Apr 2026 07:57:31 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Floorplan=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/common/floorplan/FloorplanEditor.ts | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/packages/room/src/common/floorplan/FloorplanEditor.ts b/packages/room/src/common/floorplan/FloorplanEditor.ts index 1a5fae8..f2c27d0 100644 --- a/packages/room/src/common/floorplan/FloorplanEditor.ts +++ b/packages/room/src/common/floorplan/FloorplanEditor.ts @@ -415,36 +415,27 @@ export class FloorplanEditor public getCurrentTilemapString(): string { - const highestTile = this._tilemap[this._height - 1][this._width - 1]; + // always rescan bounds: bulk operations like toggleSelectAll / fillSquareSelection + // mutate tile.height directly without updating _width/_height + this._width = 0; + this._height = 0; - if(highestTile.height === 'x') + for(let y = MAX_NUM_TILE_PER_AXIS - 1; y >= 0; y--) { - this._width = -1; - this._height = -1; + if(!this._tilemap[y]) continue; - for(let y = MAX_NUM_TILE_PER_AXIS - 1; y >= 0; y--) + for(let x = MAX_NUM_TILE_PER_AXIS - 1; x >= 0; x--) { - if(!this._tilemap[y]) continue; + if(!this._tilemap[y][x]) continue; - for(let x = MAX_NUM_TILE_PER_AXIS - 1; x >= 0; x--) + if(this._tilemap[y][x].height !== 'x') { - if(!this._tilemap[y][x]) continue; - - const tile = this._tilemap[y][x]; - - if(tile.height !== 'x') - { - if((x + 1) > this._width) - this._width = x + 1; - - if((y + 1) > this._height) - this._height = y + 1; - } + if((x + 1) > this._width) this._width = x + 1; + if((y + 1) > this._height) this._height = y + 1; } } } - const rows = []; for(let y = 0; y < this._height; y++)