From 0f6fcc36285f78992c631d8bdec215202c03b4ee Mon Sep 17 00:00:00 2001 From: Bob <80072466+bob0005@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:50:58 +0100 Subject: [PATCH] Fix threejs onclick interaction after closing tutorial manually (#2478) * Fix threejs onclick interaction after closing tutorial manually * lint --- client/src/three/components/BattleManager.ts | 2 +- client/src/three/scenes/Hexception.tsx | 2 +- client/src/three/scenes/Worldmap.ts | 2 +- .../construction/StructureConstructionMenu.tsx | 9 ++++++++- client/src/ui/components/trading/MarketModal.tsx | 2 +- client/src/ui/layouts/World.tsx | 6 +++++- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/client/src/three/components/BattleManager.ts b/client/src/three/components/BattleManager.ts index 46cc94a23..eb0f61b3b 100644 --- a/client/src/three/components/BattleManager.ts +++ b/client/src/three/components/BattleManager.ts @@ -116,7 +116,7 @@ export class BattleManager { this.battles.removeBattle(entityId); const label = this.labels.get(entityId); - + if (!label) throw new Error(`Label not found for entityId ${entityId}`); this.labelManager.removeLabel(label, this.scene); diff --git a/client/src/three/scenes/Hexception.tsx b/client/src/three/scenes/Hexception.tsx index ce1a42bbb..b5e252e0e 100644 --- a/client/src/three/scenes/Hexception.tsx +++ b/client/src/three/scenes/Hexception.tsx @@ -293,7 +293,7 @@ export default class HexceptionScene extends HexagonScene { } protected async onHexagonClick(hexCoords: HexPosition | null): Promise { - const overlay = document.querySelector(".shepherd-modal-overlay-container"); + const overlay = document.querySelector(".shepherd-modal-is-visible"); const overlayClick = document.querySelector(".allow-modal-click"); if (overlay && !overlayClick) { return; diff --git a/client/src/three/scenes/Worldmap.ts b/client/src/three/scenes/Worldmap.ts index ee7cfda89..518bec722 100644 --- a/client/src/three/scenes/Worldmap.ts +++ b/client/src/three/scenes/Worldmap.ts @@ -267,7 +267,7 @@ export default class WorldmapScene extends HexagonScene { protected onHexagonDoubleClick(hexCoords: HexPosition) {} protected onHexagonClick(hexCoords: HexPosition | null) { - const overlay = document.querySelector(".shepherd-modal-overlay-container"); + const overlay = document.querySelector(".shepherd-modal-is-visible"); const overlayClick = document.querySelector(".allow-modal-click"); if (overlay && !overlayClick) { return; diff --git a/client/src/ui/components/structures/construction/StructureConstructionMenu.tsx b/client/src/ui/components/structures/construction/StructureConstructionMenu.tsx index 4b1bc87f5..15d96ca8d 100644 --- a/client/src/ui/components/structures/construction/StructureConstructionMenu.tsx +++ b/client/src/ui/components/structures/construction/StructureConstructionMenu.tsx @@ -4,7 +4,14 @@ import useUIStore from "@/hooks/store/useUIStore"; import { Headline } from "@/ui/elements/Headline"; import { ResourceCost } from "@/ui/elements/ResourceCost"; import { multiplyByPrecision } from "@/ui/utils/utils"; -import { HYPERSTRUCTURE_CONSTRUCTION_COSTS_SCALED, HYPERSTRUCTURE_CREATION_COSTS, ID, ResourceTier, ResourcesIds, StructureType } from "@bibliothecadao/eternum"; +import { + HYPERSTRUCTURE_CONSTRUCTION_COSTS_SCALED, + HYPERSTRUCTURE_CREATION_COSTS, + ID, + ResourceTier, + ResourcesIds, + StructureType, +} from "@bibliothecadao/eternum"; import React from "react"; import { StructureCard } from "./StructureCard"; diff --git a/client/src/ui/components/trading/MarketModal.tsx b/client/src/ui/components/trading/MarketModal.tsx index 3ca0449ef..acfe464d6 100644 --- a/client/src/ui/components/trading/MarketModal.tsx +++ b/client/src/ui/components/trading/MarketModal.tsx @@ -142,7 +142,7 @@ export const MarketModal = () => { ), component: bank && ( - }> + }> { ); setWorldLoading(true); - setSubscriptions((prev) => ({ ...prev, [structureEntityId.toString()]: true, [ADMIN_BANK_ENTITY_ID.toString()]: true })); + setSubscriptions((prev) => ({ + ...prev, + [structureEntityId.toString()]: true, + [ADMIN_BANK_ENTITY_ID.toString()]: true, + })); const fetch = async () => { try { await addToSubscription(