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>
|
<script>
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
let streams = [];
|
let streams = [];
|
||||||
let fracs = 0;
|
let fracsX = 0;
|
||||||
|
let fracsY = 0;
|
||||||
let containerElement;
|
let containerElement;
|
||||||
let showButtons = false;
|
let showButtons = false;
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
streams = new URLSearchParams(window.location.search).getAll("streams");
|
streams = new URLSearchParams(window.location.search).getAll("streams");
|
||||||
console.log(streams.length);
|
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>
|
</script>
|
||||||
|
|
||||||
|
@ -34,9 +41,9 @@
|
||||||
bind:this={containerElement}
|
bind:this={containerElement}
|
||||||
class="streams"
|
class="streams"
|
||||||
style={"grid-template-rows: repeat(" +
|
style={"grid-template-rows: repeat(" +
|
||||||
fracs +
|
fracsY +
|
||||||
", 1fr); grid-template-columns: repeat(" +
|
", 1fr); grid-template-columns: repeat(" +
|
||||||
fracs +
|
fracsX +
|
||||||
", 1fr)"}
|
", 1fr)"}
|
||||||
>
|
>
|
||||||
{#if streams}
|
{#if streams}
|
||||||
|
|
Loading…
Reference in a new issue