Spaces:
Runtime error
Runtime error
Fix Fogofwar
Browse files
frontend/src/lib/components/Map.svelte
CHANGED
|
@@ -455,9 +455,14 @@
|
|
| 455 |
$: mapExploredCells.set(exploredCells);
|
| 456 |
|
| 457 |
// Recenter when Minimap requests (click on minimap) — subscribe so it always runs
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
let unsubCenter: (() => void) | null = null;
|
| 459 |
let unsubGameState: (() => void) | null = null;
|
| 460 |
onMount(() => {
|
|
|
|
| 461 |
unsubCenter = mapCenterRequest.subscribe((req) => {
|
| 462 |
if (!req) return;
|
| 463 |
vx = clamp(req.cx - vw / 2, 0, MAP_W - vw);
|
|
@@ -821,8 +826,8 @@
|
|
| 821 |
</mask>
|
| 822 |
</defs>
|
| 823 |
{#if !isObserver}
|
| 824 |
-
<rect x="0" y="0" width={MAP_W} height={MAP_H} fill="rgba(0,0,0,0.85)" mask="url(#fog-mask-unexplored)" />
|
| 825 |
-
<rect x="0" y="0" width={MAP_W} height={MAP_H} fill="rgba(0,0,0,0.45)" mask="url(#fog-mask-explored-not-visible)" pointer-events="none" />
|
| 826 |
{/if}
|
| 827 |
|
| 828 |
<!-- Tutorial target beacon (rendered above fog so it's always visible) -->
|
|
|
|
| 455 |
$: mapExploredCells.set(exploredCells);
|
| 456 |
|
| 457 |
// Recenter when Minimap requests (click on minimap) — subscribe so it always runs
|
| 458 |
+
// Fix for SVG url(#id) references breaking when SvelteKit injects a <base href> tag
|
| 459 |
+
// (common on HuggingFace Spaces and other static deployments)
|
| 460 |
+
let svgBaseUrl = '';
|
| 461 |
+
|
| 462 |
let unsubCenter: (() => void) | null = null;
|
| 463 |
let unsubGameState: (() => void) | null = null;
|
| 464 |
onMount(() => {
|
| 465 |
+
svgBaseUrl = window.location.href.split('#')[0];
|
| 466 |
unsubCenter = mapCenterRequest.subscribe((req) => {
|
| 467 |
if (!req) return;
|
| 468 |
vx = clamp(req.cx - vw / 2, 0, MAP_W - vw);
|
|
|
|
| 826 |
</mask>
|
| 827 |
</defs>
|
| 828 |
{#if !isObserver}
|
| 829 |
+
<rect x="0" y="0" width={MAP_W} height={MAP_H} fill="rgba(0,0,0,0.85)" mask="url({svgBaseUrl}#fog-mask-unexplored)" />
|
| 830 |
+
<rect x="0" y="0" width={MAP_W} height={MAP_H} fill="rgba(0,0,0,0.45)" mask="url({svgBaseUrl}#fog-mask-explored-not-visible)" pointer-events="none" />
|
| 831 |
{/if}
|
| 832 |
|
| 833 |
<!-- Tutorial target beacon (rendered above fog so it's always visible) -->
|