From ae3e2a09d9485e4ed9d704e4659c8b676b783f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=AF=5C=5F=28=E3=83=84=29=5F/=C2=AF?= Date: Mon, 30 Aug 2021 19:32:02 +0200 Subject: [PATCH 1/4] add possibility to set size of coWebsite and Jitsis via map property --- front/src/Phaser/Game/GameScene.ts | 6 ++++-- front/src/WebRtc/CoWebsiteManager.ts | 14 ++++++++++++-- front/src/WebRtc/JitsiFactory.ts | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 7ba97175..1ca52f51 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -835,7 +835,8 @@ export class GameScene extends DirtyScene { newValue as string, this.MapUrlFile, allProps.get("openWebsiteAllowApi") as boolean | undefined, - allProps.get("openWebsitePolicy") as string | undefined + allProps.get("openWebsitePolicy") as string | undefined, + allProps.get("openWebsiteWidth") as number | undefinded ); layoutManagerActionStore.removeAction("openWebsite"); }; @@ -1839,8 +1840,9 @@ ${escapedMessage} "jitsiInterfaceConfig" ); const jitsiUrl = allProps.get("jitsiUrl") as string | undefined; + const jitsiWidth = allProps.get("jitsiWidth") as number | undefined; - jitsiFactory.start(roomName, this.playerName, jwt, jitsiConfig, jitsiInterfaceConfig, jitsiUrl); + jitsiFactory.start(roomName, this.playerName, jwt, jitsiConfig, jitsiInterfaceConfig, jitsiUrl, jitsiWidth); this.connection?.setSilent(true); mediaManager.hideGameOverlay(); diff --git a/front/src/WebRtc/CoWebsiteManager.ts b/front/src/WebRtc/CoWebsiteManager.ts index f2de3580..f293399c 100644 --- a/front/src/WebRtc/CoWebsiteManager.ts +++ b/front/src/WebRtc/CoWebsiteManager.ts @@ -48,6 +48,10 @@ class CoWebsiteManager { this.cowebsiteDiv.style.width = width + "px"; } + set widthPercent(width: number) { + this.cowebsiteDiv.style.width = width + "%"; + } + get height(): number { return this.cowebsiteDiv.clientHeight; } @@ -162,7 +166,7 @@ class CoWebsiteManager { return iframe; } - public loadCoWebsite(url: string, base: string, allowApi?: boolean, allowPolicy?: string): void { + public loadCoWebsite(url: string, base: string, allowApi?: boolean, allowPolicy?: string, widthpercent?: number): void { this.load(); this.cowebsiteMainDom.innerHTML = ``; @@ -186,6 +190,9 @@ class CoWebsiteManager { .then(() => Promise.race([onloadPromise, onTimeoutPromise])) .then(() => { this.open(); + if (widthpercent) { + this.widthpercent = widthpercent; + } setTimeout(() => { this.fire(); }, animationTime); @@ -199,13 +206,16 @@ class CoWebsiteManager { /** * Just like loadCoWebsite but the div can be filled by the user. */ - public insertCoWebsite(callback: (cowebsite: HTMLDivElement) => Promise): void { + public insertCoWebsite(callback: (cowebsite: HTMLDivElement) => Promise, jitsiWidth?: number): void { this.load(); this.cowebsiteMainDom.innerHTML = ``; this.currentOperationPromise = this.currentOperationPromise .then(() => callback(this.cowebsiteMainDom)) .then(() => { this.open(); + if (jitsiWidth) { + this.widthpercent = jitsiWidth; + } setTimeout(() => { this.fire(); }, animationTime); diff --git a/front/src/WebRtc/JitsiFactory.ts b/front/src/WebRtc/JitsiFactory.ts index d2b9ebdd..1cc67273 100644 --- a/front/src/WebRtc/JitsiFactory.ts +++ b/front/src/WebRtc/JitsiFactory.ts @@ -82,7 +82,7 @@ class JitsiFactory { return slugify(instance.replace('/', '-') + "-" + roomName); } - public start(roomName: string, playerName:string, jwt?: string, config?: object, interfaceConfig?: object, jitsiUrl?: string): void { + public start(roomName: string, playerName:string, jwt?: string, config?: object, interfaceConfig?: object, jitsiUrl?: string, jitsiWidth?: number): void { coWebsiteManager.insertCoWebsite((async cowebsiteDiv => { // Jitsi meet external API maintains some data in local storage // which is sent via the appData URL parameter when joining a @@ -120,7 +120,7 @@ class JitsiFactory { this.jitsiApi.addListener('audioMuteStatusChanged', this.audioCallback); this.jitsiApi.addListener('videoMuteStatusChanged', this.videoCallback); }); - })); + }), jitsiWidth); } public async stop(): Promise { From da03e60de4ba38cd80eeb0977b75af7e29a6651a Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Mon, 30 Aug 2021 19:42:18 +0200 Subject: [PATCH 2/4] Update GameScene.ts typo fixed --- front/src/Phaser/Game/GameScene.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 1ca52f51..d46d4524 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -836,7 +836,7 @@ export class GameScene extends DirtyScene { this.MapUrlFile, allProps.get("openWebsiteAllowApi") as boolean | undefined, allProps.get("openWebsitePolicy") as string | undefined, - allProps.get("openWebsiteWidth") as number | undefinded + allProps.get("openWebsiteWidth") as number | undefined ); layoutManagerActionStore.removeAction("openWebsite"); }; From e6ae34397529ce5eb2703a26dccc70050dae2897 Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Mon, 30 Aug 2021 19:44:50 +0200 Subject: [PATCH 3/4] Update CoWebsiteManager.ts typos and style --- front/src/WebRtc/CoWebsiteManager.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/front/src/WebRtc/CoWebsiteManager.ts b/front/src/WebRtc/CoWebsiteManager.ts index f293399c..db89a55c 100644 --- a/front/src/WebRtc/CoWebsiteManager.ts +++ b/front/src/WebRtc/CoWebsiteManager.ts @@ -166,7 +166,7 @@ class CoWebsiteManager { return iframe; } - public loadCoWebsite(url: string, base: string, allowApi?: boolean, allowPolicy?: string, widthpercent?: number): void { + public loadCoWebsite(url: string, base: string, allowApi?: boolean, allowPolicy?: string, widthPercent?: number): void { this.load(); this.cowebsiteMainDom.innerHTML = ``; @@ -190,8 +190,8 @@ class CoWebsiteManager { .then(() => Promise.race([onloadPromise, onTimeoutPromise])) .then(() => { this.open(); - if (widthpercent) { - this.widthpercent = widthpercent; + if (widthPercent) { + this.widthPercent = widthPercent; } setTimeout(() => { this.fire(); @@ -206,7 +206,7 @@ class CoWebsiteManager { /** * Just like loadCoWebsite but the div can be filled by the user. */ - public insertCoWebsite(callback: (cowebsite: HTMLDivElement) => Promise, jitsiWidth?: number): void { + public insertCoWebsite(callback: (cowebsite: HTMLDivElement) => Promise, widthPercent?: number): void { this.load(); this.cowebsiteMainDom.innerHTML = ``; this.currentOperationPromise = this.currentOperationPromise @@ -214,7 +214,7 @@ class CoWebsiteManager { .then(() => { this.open(); if (jitsiWidth) { - this.widthpercent = jitsiWidth; + this.widthPercent = widthPercent; } setTimeout(() => { this.fire(); From a0d73f27d97cb25ddad38e499d36f91a3ae1fb3f Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Mon, 30 Aug 2021 19:51:14 +0200 Subject: [PATCH 4/4] Update CoWebsiteManager.ts yet another typo --- front/src/WebRtc/CoWebsiteManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/src/WebRtc/CoWebsiteManager.ts b/front/src/WebRtc/CoWebsiteManager.ts index db89a55c..b2ffb609 100644 --- a/front/src/WebRtc/CoWebsiteManager.ts +++ b/front/src/WebRtc/CoWebsiteManager.ts @@ -213,7 +213,7 @@ class CoWebsiteManager { .then(() => callback(this.cowebsiteMainDom)) .then(() => { this.open(); - if (jitsiWidth) { + if (widthPercent) { this.widthPercent = widthPercent; } setTimeout(() => {