Skip to content

Commit

Permalink
Fix threejs onclick interaction after closing tutorial manually (#2478)
Browse files Browse the repository at this point in the history
* Fix threejs onclick interaction after closing tutorial manually

* lint
  • Loading branch information
bob0005 authored Dec 13, 2024
1 parent 0e2956a commit 0f6fcc3
Showing 6 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/src/three/components/BattleManager.ts
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion client/src/three/scenes/Hexception.tsx
Original file line number Diff line number Diff line change
@@ -293,7 +293,7 @@ export default class HexceptionScene extends HexagonScene {
}

protected async onHexagonClick(hexCoords: HexPosition | null): Promise<void> {
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;
2 changes: 1 addition & 1 deletion client/src/three/scenes/Worldmap.ts
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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";

2 changes: 1 addition & 1 deletion client/src/ui/components/trading/MarketModal.tsx
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ export const MarketModal = () => {
</div>
),
component: bank && (
<Suspense fallback={ <LoadingAnimation />}>
<Suspense fallback={<LoadingAnimation />}>
<BankPanel
bankEntityId={bank.entityId}
structureEntityId={structureEntityId}
6 changes: 5 additions & 1 deletion client/src/ui/layouts/World.tsx
Original file line number Diff line number Diff line change
@@ -132,7 +132,11 @@ export const World = ({ backgroundImage }: { backgroundImage: string }) => {
);

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(

0 comments on commit 0f6fcc3

Please sign in to comment.