Files
element-call/src/state/OneOnOneLandscapeLayout.ts
T

41 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-11-06 04:36:48 -05:00
/*
Copyright 2024 New Vector Ltd.
Copyright 2026 Element Creations Ltd.
2024-11-06 04:36:48 -05:00
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
2024-11-06 04:36:48 -05:00
Please see LICENSE in the repository root for full details.
*/
import { type BehaviorSubject } from "rxjs";
import {
type Alignment,
type OneOnOneLandscapeLayout,
type OneOnOneLandscapeLayoutMedia,
} from "./layout-types";
import { type TileStore } from "./TileStore";
2024-11-06 04:36:48 -05:00
/**
* Produces a one-on-one landscape layout with the given media.
2024-11-06 04:36:48 -05:00
*/
export function oneOnOneLandscapeLayout(
media: OneOnOneLandscapeLayoutMedia,
pipAlignment$: BehaviorSubject<Alignment>,
2024-11-06 04:36:48 -05:00
prevTiles: TileStore,
): [OneOnOneLandscapeLayout, TileStore] {
const update = prevTiles.from(2);
2026-03-16 13:12:49 +01:00
update.registerGridTile(media.pip);
update.registerGridTile(media.spotlight);
2024-11-06 04:36:48 -05:00
const tiles = update.build();
2024-11-06 04:36:48 -05:00
return [
{
type: media.type,
2026-03-16 13:12:49 +01:00
spotlight: tiles.gridTilesByMedia.get(media.spotlight)!,
pip: tiles.gridTilesByMedia.get(media.pip)!,
pipAlignment$,
2024-11-06 04:36:48 -05:00
},
tiles,
];
}