mirror of
https://github.com/vector-im/element-call.git
synced 2026-11-07 00:52:28 +00:00
While also giving the logic for drag & drop of a floating tile a common home in the view model layer.
38 lines
1007 B
TypeScript
38 lines
1007 B
TypeScript
/*
|
|
Copyright 2024 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import {
|
|
type SpotlightExpandedLayout,
|
|
type SpotlightExpandedLayoutMedia,
|
|
} from "./layout-types";
|
|
import { type TileStore } from "./TileStore";
|
|
import { type FloatingTile } from "./FloatingTile";
|
|
|
|
/**
|
|
* Produces an expanded spotlight layout with the given media.
|
|
*/
|
|
export function spotlightExpandedLayout(
|
|
media: SpotlightExpandedLayoutMedia,
|
|
pipTile: FloatingTile,
|
|
prevTiles: TileStore,
|
|
): [SpotlightExpandedLayout, TileStore] {
|
|
const update = prevTiles.from(1);
|
|
update.registerSpotlight(media.spotlight, true, "transparent");
|
|
if (media.pip !== undefined) update.registerPipTile(media.pip);
|
|
const tiles = update.build();
|
|
|
|
const pipVm = tiles.gridTiles.at(0);
|
|
return [
|
|
{
|
|
type: media.type,
|
|
spotlight: tiles.spotlightTile!,
|
|
pip: pipVm && { vm: pipVm, ...pipTile },
|
|
},
|
|
tiles,
|
|
];
|
|
}
|