From c259dd582cff978232117dae4714b024c41c441c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 16 Oct 2020 09:29:18 +0200 Subject: [PATCH] Fixing change of map with relative URLs --- front/src/Phaser/Game/GameScene.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 8884cdcc..6d90525b 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -317,6 +317,13 @@ export class GameScene extends ResizableScene implements CenterListener { //permit to set bound collision this.physics.world.setBounds(0, 0, this.Map.widthInPixels, this.Map.heightInPixels); + // Let's alter browser history + let path = this.room.id; + if (this.room.hash) { + path += '#'+this.room.hash; + } + window.history.pushState({}, 'WorkAdventure', path); + //add layer on map this.Layers = new Array(); let depth = -2; @@ -404,13 +411,6 @@ export class GameScene extends ResizableScene implements CenterListener { context.stroke(); this.circleTexture.refresh(); - // Let's alter browser history - let path = this.room.id; - if (this.room.hash) { - path += '#'+this.room.hash; - } - window.history.pushState({}, 'WorkAdventure', path); - // Let's pause the scene if the connection is not established yet if (this.connection === undefined) { // Let's wait 0.5 seconds before printing the "connecting" screen to avoid blinking