Fix some tile resizing bugs
This commit is contained in:
parent
4e73c07cb2
commit
55dece274f
1 changed files with 8 additions and 6 deletions
|
@ -328,13 +328,15 @@ const cycleTileSize = (tileId: string, g: Grid): Grid => {
|
||||||
|
|
||||||
const toRow = row(to, g);
|
const toRow = row(to, g);
|
||||||
|
|
||||||
for (let src = 0; src < g.cells.length; src++) {
|
g.cells.forEach((c, src) => {
|
||||||
if (g.cells[src]?.item.id !== tileId) {
|
if (c?.slot && c.item.id !== tileId) {
|
||||||
const dest =
|
const offset =
|
||||||
row(src, g) > toRow + toHeight - 1 ? src + g.columns * newRows : src;
|
row(src, g) > toRow + candidateHeight - 1 ? g.columns * newRows : 0;
|
||||||
gappyGrid.cells[dest] = g.cells[src];
|
forEachCellInArea(src, areaEnd(src, c.columns, c.rows, g), g, (c, i) => {
|
||||||
}
|
gappyGrid.cells[i + offset] = c
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const displacedTiles: Cell[] = [];
|
const displacedTiles: Cell[] = [];
|
||||||
const toEnd = areaEnd(to, toWidth, toHeight, g);
|
const toEnd = areaEnd(to, toWidth, toHeight, g);
|
||||||
|
|
Loading…
Add table
Reference in a new issue