Fix scroll bug in spotlight view

This was a confusion between indicies of the tile and the tile position:
the spotlight tile is the 0th TilePosition, ie. the tile with order
0, not the tile with index 0.

Also comment one method to hopefully make this slightly easier to
understand.
This commit is contained in:
David Baker 2022-09-22 12:03:57 +01:00
parent 80cc10e8b9
commit 6355aa863c

View file

@ -660,6 +660,8 @@ function getSubGridPositions(
return newTilePositions; return newTilePositions;
} }
// Sets the 'order' property on tiles based on the layout param and
// other properties of the tiles, eg. 'focused' and 'presenter'
function reorderTiles(tiles: Tile[], layout: Layout) { function reorderTiles(tiles: Tile[], layout: Layout) {
if (layout === "freedom" && tiles.length === 2) { if (layout === "freedom" && tiles.length === 2) {
// 1:1 layout // 1:1 layout
@ -904,12 +906,12 @@ export function VideoGrid({
return { return {
x: x:
tilePosition.x + tilePosition.x +
(layout === "spotlight" && tileIndex !== 0 && isMobile (layout === "spotlight" && tile.order !== 0 && isMobile
? scrollPosition ? scrollPosition
: 0), : 0),
y: y:
tilePosition.y + tilePosition.y +
(layout === "spotlight" && tileIndex !== 0 && !isMobile (layout === "spotlight" && tile.order !== 0 && !isMobile
? scrollPosition ? scrollPosition
: 0), : 0),
width: tilePosition.width, width: tilePosition.width,