Clean up code and add case for single screen

This commit is contained in:
Leon Grünewald 2024-07-29 21:37:17 +02:00
parent f8412939c7
commit 8c39f7e5d0

View file

@ -8,10 +8,14 @@
onMount(() => { onMount(() => {
streams = new URLSearchParams(window.location.search).getAll("streams"); streams = new URLSearchParams(window.location.search).getAll("streams");
console.log(streams.length);
fracsX = Math.max(Math.ceil(streams.length / 2), 2); fracsX = Math.max(Math.ceil(streams.length / 2), 2);
fracsY = Math.max(Math.ceil(streams.length / 2), 2); fracsY = Math.max(Math.ceil(streams.length / 2), 2);
if (streams.length === 2) {
if (streams.length === 1) {
fracsY = 1;
fracsX = 1;
} else if (streams.length === 2) {
fracsY = Math.max(Math.ceil(streams.length / 2), 2);
fracsX = 1; fracsX = 1;
} else { } else {
fracsX = Math.max(Math.ceil(streams.length / 2), 2); fracsX = Math.max(Math.ceil(streams.length / 2), 2);
@ -34,7 +38,7 @@
} }
}}>Fullscreen</button }}>Fullscreen</button
> >
<button>Placeholder</button> <!--<button>Placeholder</button>-->
{/if} {/if}
</div> </div>
<div <div