From d672a2dead4d87b94f776112312b8bc809eb8ec7 Mon Sep 17 00:00:00 2001 From: Benedicte Quimbert Date: Wed, 10 Nov 2021 19:04:06 +0100 Subject: [PATCH] WIP API updates for tutorial and more --- front/src/Api/Events/EmbeddedWebsiteEvent.ts | 4 ++ front/src/Api/Events/IframeEvent.ts | 1 + front/src/Api/iframe/Room/EmbeddedWebsite.ts | 43 ++++++++++++++ front/src/Api/iframe/website.ts | 4 -- .../src/Phaser/Game/EmbeddedWebsiteManager.ts | 58 +++++++++++++++---- front/src/Phaser/Game/GameScene.ts | 4 +- .../EmbeddedWebsite/website_in_map_script.php | 16 +++++ 7 files changed, 115 insertions(+), 15 deletions(-) diff --git a/front/src/Api/Events/EmbeddedWebsiteEvent.ts b/front/src/Api/Events/EmbeddedWebsiteEvent.ts index 42630be1..57c24853 100644 --- a/front/src/Api/Events/EmbeddedWebsiteEvent.ts +++ b/front/src/Api/Events/EmbeddedWebsiteEvent.ts @@ -22,6 +22,8 @@ export const isEmbeddedWebsiteEvent = new tg.IsInterface() y: tg.isNumber, width: tg.isNumber, height: tg.isNumber, + origin: tg.isSingletonStringUnion("player", "map"), + scale: tg.isNumber, }) .get(); @@ -35,6 +37,8 @@ export const isCreateEmbeddedWebsiteEvent = new tg.IsInterface() visible: tg.isBoolean, allowApi: tg.isBoolean, allow: tg.isString, + origin: tg.isSingletonStringUnion("player", "map"), + scale: tg.isNumber, }) .get(); diff --git a/front/src/Api/Events/IframeEvent.ts b/front/src/Api/Events/IframeEvent.ts index e7031894..2744eaa9 100644 --- a/front/src/Api/Events/IframeEvent.ts +++ b/front/src/Api/Events/IframeEvent.ts @@ -215,6 +215,7 @@ export const isIframeQuery = (event: any): event is IframeQuery { console.log('CREATING NEW EMBEDDED IFRAME'); @@ -28,6 +30,8 @@ height: parseInt(heightField.value), }, visible: !!visibleField.value, + origin: originField.value, + scale: parseFloat(scaleField.value), }); }); @@ -61,6 +65,16 @@ const website = await WA.room.website.get('test'); website.visible = this.checked; }); + + originField.addEventListener('change', async function() { + const website = await WA.room.website.get('test'); + website.origin = this.value; + }); + + scaleField.addEventListener('change', async function() { + const website = await WA.room.website.get('test'); + website.scale = parseFloat(this.value); + }); }); }) @@ -72,6 +86,8 @@ width:
height:
URL:
Visible:
+Origin:
+Scale: