From ffcf3a25950a141a170cb2b5ffeafae64bb226da Mon Sep 17 00:00:00 2001 From: b0txec Date: Wed, 19 Aug 2026 22:07:16 +0300 Subject: [PATCH] Redraw map canvases after Monda loads --- web/src/components/map/MapView.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/src/components/map/MapView.tsx b/web/src/components/map/MapView.tsx index c2f1611..657ef90 100644 --- a/web/src/components/map/MapView.tsx +++ b/web/src/components/map/MapView.tsx @@ -13,6 +13,7 @@ import { download } from '../../helpers/download' export const MapView: Component<{ type: MapResolution, data: () => ResultKeyVal[], mode?: "temperature" | "faktiska", productionTemplate?: boolean }> = ({ type, data, mode = "temperature", productionTemplate = false }) => { const [getCanvas, setCanvas] = createSignal(); const [getImg, setImg] = createSignal(new Image()); + const [fontReady, setFontReady] = createSignal(false); const weatherIconsSignal = createSignal<{[key: string]: string;}>({}); const [getWeatherIcons] = weatherIconsSignal; const [getTitle, setTitle] = createSignal(""); @@ -42,6 +43,7 @@ export const MapView: Component<{ type: MapResolution, data: () => ResultKeyVal[ } onMount(() => { + void document.fonts.load(`700 ${props.fontSize}px Monda`).then(() => setFontReady(true)); const ctx = getCanvas()!.getContext("2d")!; const img = new Image(); img.onload = () => { @@ -60,6 +62,7 @@ export const MapView: Component<{ type: MapResolution, data: () => ResultKeyVal[ }); createEffect(() => { + fontReady(); const ctx = getCanvas()!.getContext("2d")!; const weatherIcons = getWeatherIcons(); const coordsAndData: CityData[] = data()