From 1d45bab46df2d25195d17d97ac5e48aa60651d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 13 Aug 2021 13:09:03 +0200 Subject: [PATCH] Fixing enter/leave event not properly sent on adjacent zones On adjacent zones, the zone leave event was not properly triggered when leaving a zone for the zone next to it. Closes #1366 --- front/src/Phaser/Game/GameScene.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index ce947224..883c68d3 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -915,9 +915,10 @@ export class GameScene extends DirtyScene { }); this.gameMap.onPropertyChange("zone", (newValue, oldValue) => { - if (newValue === undefined || newValue === false || newValue === "") { + if (oldValue) { iframeListener.sendLeaveEvent(oldValue as string); - } else { + } + if (newValue) { iframeListener.sendEnterEvent(newValue as string); } }); @@ -1344,7 +1345,6 @@ ${escapedMessage} iframeListener.unregisterAnswerer("getState"); iframeListener.unregisterAnswerer("loadTileset"); iframeListener.unregisterAnswerer("getMapData"); - iframeListener.unregisterAnswerer("getState"); iframeListener.unregisterAnswerer("triggerActionMessage"); iframeListener.unregisterAnswerer("removeActionMessage"); this.sharedVariablesManager?.close();