App: Use simpler way to split windows
This commit is contained in:
parent
136a6a7f90
commit
89339aa5ce
1 changed files with 20 additions and 11 deletions
|
@ -11,15 +11,24 @@
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
streams = new URLSearchParams(window.location.search).getAll("streams");
|
streams = new URLSearchParams(window.location.search).getAll("streams");
|
||||||
if (streams.length === 1) {
|
|
||||||
fracsX = 1;
|
switch (streams.length) {
|
||||||
fracsY = 1;
|
case 1:
|
||||||
} else if (streams.length === 2) {
|
fracsX = 1;
|
||||||
fracsX = 1;
|
fracsY = 1;
|
||||||
fracsY = Math.max(Math.ceil(streams.length / 2), 2);
|
break;
|
||||||
} else {
|
case 2:
|
||||||
fracsX = Math.max(Math.ceil(streams.length / 2), 2);
|
fracsX = 1;
|
||||||
fracsY = Math.max(Math.ceil(streams.length / 2), 2);
|
fracsY = 2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
fracsX = 2;
|
||||||
|
fracsY = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fracsX = Math.round(streams.length / 3);
|
||||||
|
fracsY = 3;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -31,9 +40,9 @@
|
||||||
<div
|
<div
|
||||||
bind:this={containerElement}
|
bind:this={containerElement}
|
||||||
class="streams"
|
class="streams"
|
||||||
style={"grid-template-rows: repeat(" +
|
style={"grid-template-columns: repeat(" +
|
||||||
fracsY +
|
fracsY +
|
||||||
", 1fr); grid-template-columns: repeat(" +
|
", 1fr); grid-template-rows: repeat(" +
|
||||||
fracsX +
|
fracsX +
|
||||||
", 1fr)"}
|
", 1fr)"}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue