Fix some tile resizing bugs

This commit is contained in:
Robin Townsend 2023-01-30 17:04:43 -05:00
parent 4e73c07cb2
commit 55dece274f

View file

@ -328,13 +328,15 @@ const cycleTileSize = (tileId: string, g: Grid): Grid => {
const toRow = row(to, g);
for (let src = 0; src < g.cells.length; src++) {
if (g.cells[src]?.item.id !== tileId) {
const dest =
row(src, g) > toRow + toHeight - 1 ? src + g.columns * newRows : src;
gappyGrid.cells[dest] = g.cells[src];
g.cells.forEach((c, src) => {
if (c?.slot && c.item.id !== tileId) {
const offset =
row(src, g) > toRow + candidateHeight - 1 ? g.columns * newRows : 0;
forEachCellInArea(src, areaEnd(src, c.columns, c.rows, g), g, (c, i) => {
gappyGrid.cells[i + offset] = c
})
}
}
})
const displacedTiles: Cell[] = [];
const toEnd = areaEnd(to, toWidth, toHeight, g);