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(() => {
|
||||
streams = new URLSearchParams(window.location.search).getAll("streams");
|
||||
if (streams.length === 1) {
|
||||
fracsX = 1;
|
||||
fracsY = 1;
|
||||
} else if (streams.length === 2) {
|
||||
fracsX = 1;
|
||||
fracsY = Math.max(Math.ceil(streams.length / 2), 2);
|
||||
} else {
|
||||
fracsX = Math.max(Math.ceil(streams.length / 2), 2);
|
||||
fracsY = Math.max(Math.ceil(streams.length / 2), 2);
|
||||
|
||||
switch (streams.length) {
|
||||
case 1:
|
||||
fracsX = 1;
|
||||
fracsY = 1;
|
||||
break;
|
||||
case 2:
|
||||
fracsX = 1;
|
||||
fracsY = 2;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
fracsX = 2;
|
||||
fracsY = 2;
|
||||
break;
|
||||
default:
|
||||
fracsX = Math.round(streams.length / 3);
|
||||
fracsY = 3;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -31,9 +40,9 @@
|
|||
<div
|
||||
bind:this={containerElement}
|
||||
class="streams"
|
||||
style={"grid-template-rows: repeat(" +
|
||||
style={"grid-template-columns: repeat(" +
|
||||
fracsY +
|
||||
", 1fr); grid-template-columns: repeat(" +
|
||||
", 1fr); grid-template-rows: repeat(" +
|
||||
fracsX +
|
||||
", 1fr)"}
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue