Add case for only two screens
This commit is contained in:
parent
5014739834
commit
b53d96a8f6
1 changed files with 11 additions and 4 deletions
|
@ -1,14 +1,21 @@
|
|||
<script>
|
||||
import { onMount } from "svelte";
|
||||
let streams = [];
|
||||
let fracs = 0;
|
||||
let fracsX = 0;
|
||||
let fracsY = 0;
|
||||
let containerElement;
|
||||
let showButtons = false;
|
||||
|
||||
onMount(() => {
|
||||
streams = new URLSearchParams(window.location.search).getAll("streams");
|
||||
console.log(streams.length);
|
||||
fracs = Math.ceil(streams.length / 2);
|
||||
fracsX = Math.max(Math.ceil(streams.length / 2), 2);
|
||||
fracsY = Math.max(Math.ceil(streams.length / 2), 2);
|
||||
if (streams.length === 2) {
|
||||
fracsX = 1;
|
||||
} else {
|
||||
fracsX = Math.max(Math.ceil(streams.length / 2), 2);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -34,9 +41,9 @@
|
|||
bind:this={containerElement}
|
||||
class="streams"
|
||||
style={"grid-template-rows: repeat(" +
|
||||
fracs +
|
||||
fracsY +
|
||||
", 1fr); grid-template-columns: repeat(" +
|
||||
fracs +
|
||||
fracsX +
|
||||
", 1fr)"}
|
||||
>
|
||||
{#if streams}
|
||||
|
|
Loading…
Reference in a new issue