Hide main cowebsite
This commit is contained in:
parent
60c17ecea2
commit
75d42209f4
@ -5,6 +5,7 @@
|
||||
import { coWebsitesNotAsleep, mainCoWebsite } from "../../Stores/CoWebsiteStore";
|
||||
import { highlightedEmbedScreen } from "../../Stores/EmbedScreensStore";
|
||||
import type { CoWebsite } from "../../WebRtc/CoWebsiteManager";
|
||||
import { iframeStates } from "../../WebRtc/CoWebsiteManager";
|
||||
import { coWebsiteManager } from "../../WebRtc/CoWebsiteManager";
|
||||
|
||||
export let index: number;
|
||||
@ -35,8 +36,12 @@
|
||||
if ($mainCoWebsite.iframe.id === coWebsite.iframe.id) {
|
||||
const coWebsites = $coWebsitesNotAsleep;
|
||||
const newMain = $highlightedEmbedScreen ?? coWebsites.length > 1 ? coWebsites[1] : undefined;
|
||||
if (newMain) {
|
||||
if (newMain && newMain.iframe.id !== $mainCoWebsite.iframe.id) {
|
||||
coWebsiteManager.goToMain(newMain);
|
||||
} else if (coWebsiteManager.getMainState() === iframeStates.closed) {
|
||||
coWebsiteManager.displayMain();
|
||||
} else {
|
||||
coWebsiteManager.hideMain();
|
||||
}
|
||||
} else {
|
||||
highlightedEmbedScreen.toggleHighlight({
|
||||
|
@ -10,7 +10,7 @@ import { jitsiFactory } from "./JitsiFactory";
|
||||
import { gameManager } from "../Phaser/Game/GameManager";
|
||||
import { LayoutMode } from "./LayoutManager";
|
||||
|
||||
enum iframeStates {
|
||||
export enum iframeStates {
|
||||
closed = 1,
|
||||
loading, // loading an iframe can be slow, so we show some placeholder until it is ready
|
||||
opened,
|
||||
@ -75,6 +75,10 @@ class CoWebsiteManager {
|
||||
this.resizeAllIframes();
|
||||
});
|
||||
|
||||
public getMainState() {
|
||||
return this.openedMain;
|
||||
}
|
||||
|
||||
get width(): number {
|
||||
return this.cowebsiteDom.clientWidth;
|
||||
}
|
||||
@ -306,6 +310,27 @@ class CoWebsiteManager {
|
||||
});
|
||||
}
|
||||
|
||||
public displayMain() {
|
||||
const coWebsite = this.getMainCoWebsite();
|
||||
if (coWebsite) {
|
||||
coWebsite.iframe.style.display = "block";
|
||||
}
|
||||
this.loadMain();
|
||||
this.openMain();
|
||||
this.fire();
|
||||
}
|
||||
|
||||
public hideMain() {
|
||||
const coWebsite = this.getMainCoWebsite();
|
||||
if (coWebsite) {
|
||||
coWebsite.iframe.style.display = "none";
|
||||
}
|
||||
this.cowebsiteDom.classList.add("closing");
|
||||
this.cowebsiteDom.classList.remove("opened");
|
||||
this.openedMain = iframeStates.closed;
|
||||
this.fire();
|
||||
}
|
||||
|
||||
private closeMain(): void {
|
||||
this.toggleFullScreenIcon(true);
|
||||
this.cowebsiteDom.classList.add("closing");
|
||||
@ -631,6 +656,11 @@ class CoWebsiteManager {
|
||||
this.loadMain(coWebsite.widthPercent);
|
||||
}
|
||||
|
||||
// Check if the main is hide
|
||||
if (this.getMainCoWebsite() && this.openedMain === iframeStates.closed) {
|
||||
this.displayMain();
|
||||
}
|
||||
|
||||
coWebsite.state.set("loading");
|
||||
|
||||
const mainCoWebsite = this.getMainCoWebsite();
|
||||
|
Loading…
Reference in New Issue
Block a user