2024-11-06 04:36:48 -05:00
|
|
|
/*
|
|
|
|
|
Copyright 2024 New Vector Ltd.
|
|
|
|
|
|
2025-02-18 17:59:58 +00: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.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-10-13 16:24:55 +02:00
|
|
|
import { type PipLayout, type PipLayoutMedia } from "./layout-types.ts";
|
2024-12-11 09:27:55 +00:00
|
|
|
import { type TileStore } from "./TileStore";
|
2024-11-06 04:36:48 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Produces a picture-in-picture layout with the given media.
|
|
|
|
|
*/
|
|
|
|
|
export function pipLayout(
|
|
|
|
|
media: PipLayoutMedia,
|
|
|
|
|
prevTiles: TileStore,
|
|
|
|
|
): [PipLayout, TileStore] {
|
2024-12-12 17:32:13 -05:00
|
|
|
const update = prevTiles.from(0);
|
2024-11-06 04:36:48 -05:00
|
|
|
update.registerSpotlight(media.spotlight, true);
|
|
|
|
|
const tiles = update.build();
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
type: media.type,
|
|
|
|
|
spotlight: tiles.spotlightTile!,
|
|
|
|
|
},
|
|
|
|
|
tiles,
|
|
|
|
|
];
|
|
|
|
|
}
|