diff --git a/package-lock.json b/package-lock.json index 1aa46b8..b013f5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "stellarmaps", - "version": "0.12.0", + "version": "0.13.0-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "stellarmaps", - "version": "0.12.0", + "version": "0.13.0-dev", "dependencies": { "@electron-toolkit/preload": "^3.0.1", "@electron-toolkit/utils": "^3.0.0", @@ -85,6 +85,7 @@ "svelte-eslint-parser": "^0.34.1", "tailwindcss": "^3.4.3", "typescript": "^5.4.5", + "utility-types": "^3.11.0", "vite": "^5.2.8" } }, @@ -13262,6 +13263,15 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, + "node_modules/utility-types": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.11.0.tgz", + "integrity": "sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/package.json b/package.json index 8ae691a..bc2bcf4 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "vite:build": "vite build", "format": "prettier --write .", "format:check": "prettier --check .", - "lint": "eslint . --ext .ts", + "lint": "eslint . --ext .ts,.svelte", "typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "svelte-check": "svelte-check --tsconfig ./tsconfig.json", "typecheck": "npm run typecheck:node && npm run svelte-check", @@ -68,6 +68,7 @@ "svelte-eslint-parser": "^0.34.1", "tailwindcss": "^3.4.3", "typescript": "^5.4.5", + "utility-types": "^3.11.0", "vite": "^5.2.8" }, "dependencies": { diff --git a/src/renderer/src/App.svelte b/src/renderer/src/App.svelte index c885dc8..513ff7b 100644 --- a/src/renderer/src/App.svelte +++ b/src/renderer/src/App.svelte @@ -1,24 +1,26 @@ -{#if data?.legend.items.length && $mapSettings.legend} +{#if (data?.legend.items.length ?? 0) > 0 && $mapSettings.legend} - {#if colors} + {#if colors && data} {/if} diff --git a/src/renderer/src/lib/map/Map.svelte b/src/renderer/src/lib/map/Map.svelte index 5428ef8..41e001f 100644 --- a/src/renderer/src/lib/map/Map.svelte +++ b/src/renderer/src/lib/map/Map.svelte @@ -1,5 +1,6 @@ + {@html fontFace} {#if data} diff --git a/src/renderer/src/lib/map/MapContainer.svelte b/src/renderer/src/lib/map/MapContainer.svelte index 08a7993..80e478c 100644 --- a/src/renderer/src/lib/map/MapContainer.svelte +++ b/src/renderer/src/lib/map/MapContainer.svelte @@ -1,17 +1,19 @@ -
+
{#if dataOrNull && colorsOrNull && openedSystem == null}
@@ -510,7 +513,8 @@ }} on:click={onMapClick} class:hidden={openedSystem != null} - class:cursor-pointer={(mapModes[$mapSettings.mapMode]?.hasPov && tooltip?.countryId) || + class:cursor-pointer={(mapModes[$mapSettings.mapMode]?.hasPov && + tooltip?.countryId != null) ?? (tooltip != null && !tooltip.hidden)} class="h-full w-full" > diff --git a/src/renderer/src/lib/map/MapTooltip.svelte b/src/renderer/src/lib/map/MapTooltip.svelte index 8f41af2..e1af778 100644 --- a/src/renderer/src/lib/map/MapTooltip.svelte +++ b/src/renderer/src/lib/map/MapTooltip.svelte @@ -1,7 +1,8 @@ import * as d3Shape from 'd3-shape'; + import type { PickByValue } from 'utility-types'; + import { - mapSettings, - mapSettingsConfig, type IconMapSettings, type MapSettings, + mapSettings, + mapSettingsConfig, type SettingConfigIcon, } from '../settings'; import { mapModes } from './data/mapModes'; @@ -16,7 +18,7 @@ export let colors: Record; interface IconSettingMetadata { - systemProperty?: keyof ProcessedSystem; + systemProperty?: keyof PickByValue; mustKnowOwner?: boolean; } const metadata: Record = { diff --git a/src/renderer/src/lib/map/data/processLabels.ts b/src/renderer/src/lib/map/data/processLabels.ts index 0c13ed2..0a736d1 100644 --- a/src/renderer/src/lib/map/data/processLabels.ts +++ b/src/renderer/src/lib/map/data/processLabels.ts @@ -169,10 +169,14 @@ export default function processLabels( } return { point: inverseX(pointFromGeoJSON(point)), - emblemWidth: emblemWidth != null ? emblemWidth * SCALE : null, - emblemHeight: emblemWidth != null ? emblemWidth * emblemAspectRatio * SCALE : null, - textWidth: textWidth != null ? textWidth * SCALE : null, - textHeight: textWidth != null ? textWidth * textAspectRatio * SCALE : null, + emblemWidth: emblemWidth != null && emblemWidth > 0 ? emblemWidth * SCALE : null, + emblemHeight: + emblemWidth != null && emblemWidth > 0 + ? emblemWidth * emblemAspectRatio * SCALE + : null, + textWidth: textWidth != null && textWidth > 0 ? textWidth * SCALE : null, + textHeight: + textWidth != null && textWidth > 0 ? textWidth * textAspectRatio * SCALE : null, }; }) : []; diff --git a/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte b/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte index f3cbd96..79462e3 100644 --- a/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte +++ b/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte @@ -1,9 +1,10 @@