Hide main cowebsite

This commit is contained in:
Alexis Faizeau 2022-02-07 17:09:52 +01:00
parent 60c17ecea2
commit 75d42209f4
2 changed files with 37 additions and 2 deletions

View file

@ -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();