From 3d32fb90dc6fdcd13830f52432dbb48b909ef742 Mon Sep 17 00:00:00 2001 From: Gregoire Parant Date: Mon, 23 Nov 2020 20:34:05 +0100 Subject: [PATCH] Add constant --- front/src/Phaser/Game/GameScene.ts | 17 +++++++++++------ front/src/WebRtc/LayoutManager.ts | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index a07b4c3a..45fb6a06 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -31,7 +31,12 @@ import {Queue} from 'queue-typescript'; import {SimplePeer, UserSimplePeerInterface} from "../../WebRtc/SimplePeer"; import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene"; import {loadAllLayers, loadObject, loadPlayerCharacters} from "../Entity/body_character"; -import {CenterListener, layoutManager, LayoutMode} from "../../WebRtc/LayoutManager"; +import { + CenterListener, + layoutManager, + LayoutMode, + ON_ACTION_TRIGGER_BUTTON, TRIGGER_JITSI_PROPERTIES, TRIGGER_WEBSITE_PROPERTIES +} from "../../WebRtc/LayoutManager"; import Texture = Phaser.Textures.Texture; import Sprite = Phaser.GameObjects.Sprite; import CanvasTexture = Phaser.Textures.CanvasTexture; @@ -586,9 +591,9 @@ export class GameScene extends ResizableScene implements CenterListener { layoutManager.removeActionButton('openWebsite', this.userInputManager); }; - const openWebsiteTriggerValue = allProps.get('openWebsiteTrigger'); - if(openWebsiteTriggerValue && openWebsiteTriggerValue === 'onaction') { - layoutManager.addActionButton('openWebsite', 'Click on SPACE to open web site', () => { + const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES); + if(openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) { + layoutManager.addActionButton('openWebsite', 'Click on SPACE to open the web site', () => { openWebsiteFunction(); }, this.userInputManager); }else{ @@ -612,8 +617,8 @@ export class GameScene extends ResizableScene implements CenterListener { layoutManager.removeActionButton('jitsiRoom', this.userInputManager); } - const jitsiTriggerValue = allProps.get('jitsiTrigger'); - if(jitsiTriggerValue && jitsiTriggerValue === 'onaction') { + const jitsiTriggerValue = allProps.get(TRIGGER_JITSI_PROPERTIES); + if(jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) { layoutManager.addActionButton('jitsiRoom', 'Click on SPACE to enter in jitsi meet room', () => { openJitsiRoomFunction(); }, this.userInputManager); diff --git a/front/src/WebRtc/LayoutManager.ts b/front/src/WebRtc/LayoutManager.ts index 4013f1d8..a6b9fa27 100644 --- a/front/src/WebRtc/LayoutManager.ts +++ b/front/src/WebRtc/LayoutManager.ts @@ -23,6 +23,10 @@ export interface CenterListener { onCenterChange(): void; } +export const ON_ACTION_TRIGGER_BUTTON = 'onaction'; +export const TRIGGER_WEBSITE_PROPERTIES = 'openWebsiteTrigger'; +export const TRIGGER_JITSI_PROPERTIES = 'jitsiTrigger'; + /** * This class is in charge of the video-conference layout. * It receives positioning requests for videos and does its best to place them on the screen depending on the active layout mode.