diff --git a/app/components/map/MiniMap.vue b/app/components/map/MiniMap.vue new file mode 100644 index 0000000..0739a96 --- /dev/null +++ b/app/components/map/MiniMap.vue @@ -0,0 +1,80 @@ + + + + + + + + + + diff --git a/app/components/map/VillageMarker.vue b/app/components/map/VillageMarker.vue index b8599bc..23622a5 100644 --- a/app/components/map/VillageMarker.vue +++ b/app/components/map/VillageMarker.vue @@ -8,9 +8,9 @@ const props = defineProps<{ tier: 1 | 2 | 3; relation: MapRelation }>() const tones = computed(() => props.relation === 'barbarian' ? { wallLight: '#d6cfc2', wallDark: '#a99f90', roofLight: '#8e857a', roofDark: '#6c6459' } - : { wallLight: '#efdfbd', wallDark: '#c8ad84', roofLight: '#c2643a', roofDark: '#963f1d' }, + : { wallLight: '#e3cfa2', wallDark: '#b49870', roofLight: '#9c4a26', roofDark: '#73321a' }, ) -const flag = computed(() => ({ own: '#f2b705', player: '#c0392b', barbarian: '#7d7d7d' })[props.relation]) +const flag = computed(() => ({ own: '#d9b44a', player: '#962a1f', barbarian: '#8b9094' })[props.relation]) interface Hut { cx: number @@ -63,7 +63,7 @@ const pole = computed(() => { - + diff --git a/app/components/map/WorldMap.vue b/app/components/map/WorldMap.vue index efbab19..d93b18d 100644 --- a/app/components/map/WorldMap.vue +++ b/app/components/map/WorldMap.vue @@ -25,7 +25,7 @@ const hash = (x: number, y: number) => { h = Math.imul(h ^ (h >>> 13), 1274126177) return ((h ^ (h >>> 16)) >>> 0) / 4294967296 } -const GRASS = ['#b9d08f', '#b1ca87', '#c0d596', '#acc580'] +const GRASS = ['#7f9645', '#78903f', '#86994b', '#73893c'] interface Field { x: number @@ -154,7 +154,7 @@ const panOffset = computed(() => (drag.value?.moved ? `translate(${drag.value.dx :width="width" :height="height" :viewBox="`0 0 ${width} ${height}`" - class="block touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-amber-600" + class="block touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-gold-500" :class="drag?.moved ? 'cursor-grabbing' : 'cursor-grab'" role="application" tabindex="0" @@ -179,9 +179,9 @@ const panOffset = computed(() => (drag.value?.moved ? `translate(${drag.value.dx - - - + + + @@ -195,7 +195,7 @@ const panOffset = computed(() => (drag.value?.moved ? `translate(${drag.value.dx font-size="17" font-weight="700" font-family="Georgia, serif" - fill="rgb(43 33 24 / 0.28)" + fill="rgb(243 231 201 / 0.6)" > {{ c.label }} @@ -207,7 +207,7 @@ const panOffset = computed(() => (drag.value?.moved ? `translate(${drag.value.dx :y1="l.y1" :x2="l.x2" :y2="l.y2" - :stroke="l.kind === 'continent' ? 'rgb(43 33 24 / 0.75)' : 'rgb(43 33 24 / 0.22)'" + :stroke="l.kind === 'continent' ? 'rgb(31 21 12 / 0.85)' : 'rgb(31 21 12 / 0.3)'" :stroke-width="l.kind === 'continent' ? 2.5 : 1" /> @@ -227,8 +227,8 @@ const panOffset = computed(() => (drag.value?.moved ? `translate(${drag.value.dx :width="field - 2" :height="field - 2" rx="4" - fill="rgb(255 255 255 / 0.18)" - stroke="#b45309" + fill="rgb(217 180 74 / 0.18)" + stroke="#d9b44a" stroke-width="2.5" /> @@ -236,8 +236,8 @@ const panOffset = computed(() => (drag.value?.moved ? `translate(${drag.value.dx - - + + (drag.value?.moved ? `translate(${drag.value.dx :y="RULER / 2 + 4" text-anchor="middle" :font-size="rulerFont" - fill="#4a3b2e" + fill="#2f2013" class="tabular-nums" > {{ view.x + col - 1 }} @@ -257,7 +257,7 @@ const panOffset = computed(() => (drag.value?.moved ? `translate(${drag.value.dx :y="RULER + (row - 0.5) * field + 4" text-anchor="middle" :font-size="rulerFont" - fill="#4a3b2e" + fill="#2f2013" class="tabular-nums" > {{ view.y + row - 1 }} diff --git a/app/pages/map/[worldId].vue b/app/pages/map/[worldId].vue index 541f0bb..10cc08b 100644 --- a/app/pages/map/[worldId].vue +++ b/app/pages/map/[worldId].vue @@ -6,6 +6,15 @@ const router = useRouter() const { view, error, busy, load } = useMap(Number(route.params.worldId)) useState('world.current', () => null).value = Number(route.params.worldId) +// The minimap: a 61 × 61 window around the same centre, refetched when the centre moves. +const overview = useMap(Number(route.params.worldId)) +watch( + () => view.value?.center, + (c, old) => { + if (c && (c.x !== old?.x || c.y !== old?.y)) overview.load(c, 61, 61) + }, +) + const ZOOM = [36, 52, 72] const zoom = ref(1) const field = computed(() => ZOOM[zoom.value]!) @@ -93,24 +102,16 @@ const continent = computed(() => (view.value ? `K${Math.floor(view.value.center. - {{ $t('map.subtitle') }} - - {{ $t('map.title') }} - {{ view.center.x }}|{{ view.center.y }} · {{ continent }} + {{ $t('map.title') }} + + {{ $t('map.continent', { k: continent }) }} + {{ view.center.x }}|{{ view.center.y }} - - x - - | - y - - {{ $t('map.jump') }} - {{ $t('map.home') }} - + − + @@ -121,8 +122,9 @@ const continent = computed(() => (view.value ? `K${Math.floor(view.value.center. - - + + + (view.value ? `K${Math.floor(view.value.center.
{{ $t('map.subtitle') }}
{{ $t('map.title') }}