diff --git a/hwe/ts/components/MapViewer.vue b/hwe/ts/components/MapViewer.vue index 0866631d..dc8f986a 100644 --- a/hwe/ts/components/MapViewer.vue +++ b/hwe/ts/components/MapViewer.vue @@ -188,7 +188,14 @@ const gameConstStore = unwrap_err( const tooltipDom = ref>(); const map_area = ref>(); const { elementX: cursorX, elementY: cursorY, isOutside } = useMouseInElement(map_area); -const { width: tooltipWidth } = useElementSize(tooltipDom); + +const tooltipWidth = ref(0); +const { width: tooltipCurrWidth } = useElementSize(tooltipDom); +watch(tooltipCurrWidth, (newWidth)=>{ + if(newWidth == 0) return; + tooltipWidth.value = newWidth; +}, {immediate: true}); + const { sourceType: cursorType } = useMouse(); const emit = defineEmits<{ (event: "city-click", city: MapCityParsed, e: MouseEvent | TouchEvent): void;