Keep tile elements in a stable order
This commit is contained in:
parent
6784d2ba97
commit
4fc8598e36
1 changed files with 2 additions and 7 deletions
|
@ -470,13 +470,8 @@ export const NewVideoGrid: FC<Props> = ({
|
||||||
if (slotGridGeneration !== grid.generation) return prevTiles ?? [];
|
if (slotGridGeneration !== grid.generation) return prevTiles ?? [];
|
||||||
|
|
||||||
const slotCells = grid.cells.filter((c) => c?.slot) as Cell[];
|
const slotCells = grid.cells.filter((c) => c?.slot) as Cell[];
|
||||||
return zipWith(slotCells, slotRects, (cell, rect) => ({
|
const tileRects = new Map<TileDescriptor, Rect>(zipWith(slotCells, slotRects, (cell, rect) => [cell.item, rect]))
|
||||||
item: cell.item,
|
return items.map(item => ({ ...tileRects.get(item)!, item }))
|
||||||
x: rect.x,
|
|
||||||
y: rect.y,
|
|
||||||
width: rect.width,
|
|
||||||
height: rect.height,
|
|
||||||
}));
|
|
||||||
},
|
},
|
||||||
[slotRects, grid, slotGridGeneration]
|
[slotRects, grid, slotGridGeneration]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue