Merge branch 'develop' of github.com:thecodingmachine/workadventure into main

This commit is contained in:
_Bastler 2021-06-15 09:21:40 +02:00
commit 29da03ee44
3 changed files with 19 additions and 16 deletions

View File

@ -2,24 +2,24 @@
import { fly } from 'svelte/transition'; import { fly } from 'svelte/transition';
import {requestVisitCardsStore} from "../../Stores/GameStore"; import {requestVisitCardsStore} from "../../Stores/GameStore";
import {onMount} from "svelte"; import {onMount} from "svelte";
export let visitCardUrl: string; export let visitCardUrl: string;
let w = '500px'; let w = '500px';
let h = '250px'; let h = '250px';
let hidden = true; let hidden = true;
let cvIframe; let cvIframe;
function closeCard() { function closeCard() {
requestVisitCardsStore.set(null); requestVisitCardsStore.set(null);
} }
function handleIframeMessage(message:any) { function handleIframeMessage(message:any) {
if (message.data.type === 'cvIframeSize') { if (message.data.type === 'cvIframeSize') {
w = (message.data.data.w) + 'px'; w = (message.data.data.w) + 'px';
h = (message.data.data.h) + 'px'; h = (message.data.data.h) + 'px';
} }
} }
onMount(() => { onMount(() => {
cvIframe.onload = () => hidden = false cvIframe.onload = () => hidden = false
cvIframe.onerror = () => hidden = false cvIframe.onerror = () => hidden = false
@ -42,7 +42,7 @@
0% { transform: rotate(0deg); } 0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); } 100% { transform: rotate(360deg); }
} }
.visitCard { .visitCard {
pointer-events: all; pointer-events: all;
margin-left: auto; margin-left: auto;
@ -54,7 +54,7 @@
border: 0; border: 0;
max-width: 80vw; max-width: 80vw;
overflow: hidden; overflow: hidden;
&.hidden { &.hidden {
visibility: hidden; visibility: hidden;
position: absolute; position: absolute;
@ -78,7 +78,7 @@
<button class="nes-btn is-popUpElement" on:click={closeCard}>Close</button> <button class="nes-btn is-popUpElement" on:click={closeCard}>Close</button>
</div> </div>
{/if} {/if}
</section> </section>
<svelte:window on:message={handleIframeMessage}/> <svelte:window on:message={handleIframeMessage}/>

View File

@ -3,6 +3,7 @@ import ScaleManager = Phaser.Scale.ScaleManager;
import {coWebsiteManager} from "../../WebRtc/CoWebsiteManager"; import {coWebsiteManager} from "../../WebRtc/CoWebsiteManager";
import type {Game} from "../Game/Game"; import type {Game} from "../Game/Game";
import {ResizableScene} from "../Login/ResizableScene"; import {ResizableScene} from "../Login/ResizableScene";
import {HtmlUtils} from "../../WebRtc/HtmlUtils";
class WaScaleManager { class WaScaleManager {
@ -39,6 +40,12 @@ class WaScaleManager {
const style = this.scaleManager.canvas.style; const style = this.scaleManager.canvas.style;
style.width = Math.ceil(realSize.width / devicePixelRatio) + 'px'; style.width = Math.ceil(realSize.width / devicePixelRatio) + 'px';
style.height = Math.ceil(realSize.height / devicePixelRatio) + 'px'; style.height = Math.ceil(realSize.height / devicePixelRatio) + 'px';
// Resize the game element at the same size at the canvas
const gameStyle = HtmlUtils.getElementByIdOrFail<HTMLDivElement>('game').style;
gameStyle.width = style.width;
gameStyle.height = style.height;
// Note: onResize will be called twice (once here and once in Game.ts), but we have no better way. // Note: onResize will be called twice (once here and once in Game.ts), but we have no better way.
for (const scene of this.game.scene.getScenes(true)) { for (const scene of this.game.scene.getScenes(true)) {
if (scene instanceof ResizableScene) { if (scene instanceof ResizableScene) {

View File

@ -353,13 +353,13 @@ video.myCamVideo{
body { body {
margin: 0; margin: 0;
height: 100vh; height: 100%;
width: 100vw; width: 100%;
} }
.main-container { .main-container {
height: 100vh; height: 100%;
width: 100vw; width: 100%;
position: absolute; position: absolute;
} }
@ -379,10 +379,7 @@ body {
} }
#game { #game {
height: 100%; position: relative; /* Position relative is needed for the game-overlay. */
width: 100%;
position: relative;
/* Position relative is needed for the game-overlay. */
} }
.audioplayer:first-child { .audioplayer:first-child {
@ -639,7 +636,6 @@ input[type=range]:focus::-ms-fill-upper {
.media-container { .media-container {
display: flex; display: flex;
justify-content: center;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
} }