diff --git a/src/TheLivingWorld.Web/src/main.ts b/src/TheLivingWorld.Web/src/main.ts index 1585f0c..12ce373 100644 --- a/src/TheLivingWorld.Web/src/main.ts +++ b/src/TheLivingWorld.Web/src/main.ts @@ -139,6 +139,9 @@ async function ensureMap(): Promise { async function openWorld(id: string): Promise { try { setStatus('Loading map…', 'busy'); + // Stage must be visible before Pixi init / camera.fit — a hidden host measures as 0×0 and + // leaves the canvas stuck as a thin strip. + showGame(); await ensureMap(); const map = await api.getMap(id); @@ -148,10 +151,10 @@ async function openWorld(id: string): Promise { view.showWorld(map); elements.worldTitle.textContent = map.name; elements.hud.textContent = ''; - showGame(); setStatus(''); await refreshWorldList(); } catch (error) { + showMenu(); setStatus(`Could not open world: ${message(error)}`, 'error'); } } diff --git a/src/TheLivingWorld.Web/src/map/mapView.ts b/src/TheLivingWorld.Web/src/map/mapView.ts index dc8fe1f..5ce7da1 100644 --- a/src/TheLivingWorld.Web/src/map/mapView.ts +++ b/src/TheLivingWorld.Web/src/map/mapView.ts @@ -98,6 +98,9 @@ export class MapView { this.labels.clear(); this.worldSizeMeters = map.sizeMeters; + // Host may have just become visible after a menu → game switch; sync the renderer before fitting. + this.app.resize(); + this.paintBackground(); this.camera.fit(map.sizeMeters, this.viewport); this.chunks.setWorld(map.id, map.chunks);