building-use-map/src/basemap.ts
HangerThem 44bc6207a9 feat(ui): polish pass - visual refresh, dark mode, smoother map, mobile sheet
Visual
- Design tokens (spacing, radius, type, motion) with a dark theme that follows
  prefers-color-scheme; map palette in theme.ts (exports/print stay light)
- Segmented controls (language, colour scheme), switches, styled slider/select,
  icon buttons, cards, focus rings, hover/active states, reduced-motion support
- Info panel card with animation, tooltip that stays on screen, grouped zoom buttons

Map
- Redraws batched per animation frame; animated zoom/fit, pan inertia,
  trackpad pinch, pointer cursor and outline for the hovered building
- Hovering a legend row highlights that category on the map

Loading & feedback
- Progress bar + "Loading n/m" pill; status line with icons, collapsible
  basemap failure details, success messages fade
- A newer load supersedes one in flight; a failed buildings query is reported
  immediately instead of after the basemap retries

Convenience
- Keyboard: +/- zoom, 0 fit, arrows pan, Esc closes
- Legend All/None, double-click or Alt-click to show only one category
- Settings and last location remembered; #lat,lon,radius in the URL to share,
  copy-link button, "my location" button
- Mobile: full-screen map with a draggable bottom sheet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:01:08 +01:00

53 lines
1.6 KiB
TypeScript

import type { BaseColor } from './theme'
/* ================= basemap styles ================= */
/** ZABAGED layer ids on the ČÚZK MapServer. */
export const ZAB_LAYERS = {
road: 79,
street: 84,
track: 83,
path: 82,
rail: 75,
stream: 93,
water: 132,
green: 134,
garden: 135,
cemetery: 116,
parking: 123,
}
export type BaseKey = keyof typeof ZAB_LAYERS
/** Colours are palette keys (theme.ts), so the basemap follows light/dark mode. */
interface PolyStyle {
k: BaseKey
t: 'poly'
fill: BaseColor
stroke?: BaseColor
}
/** m: width in true metres, min: minimum width in px */
interface LineStyle {
k: BaseKey
t: 'line'
c: BaseColor
m: number
min: number
dash?: number[]
}
export type BaseStyle = PolyStyle | LineStyle
// Drawn in this order (later entries on top)
export const BASE: BaseStyle[] = [
{ k: 'garden', t: 'poly', fill: 'garden' },
{ k: 'green', t: 'poly', fill: 'green' },
{ k: 'cemetery', t: 'poly', fill: 'cemetery', stroke: 'cemeteryEdge' },
{ k: 'parking', t: 'poly', fill: 'parking', stroke: 'parkingEdge' },
{ k: 'water', t: 'poly', fill: 'water', stroke: 'waterEdge' },
{ k: 'stream', t: 'line', c: 'stream', m: 2, min: 1.2 },
{ k: 'path', t: 'line', c: 'path', m: 1, min: 0.8, dash: [2, 3] },
{ k: 'track', t: 'line', c: 'track', m: 2, min: 1, dash: [6, 4] },
{ k: 'rail', t: 'line', c: 'rail', m: 3, min: 1.2, dash: [8, 4] },
{ k: 'street', t: 'line', c: 'streetCasing', m: 7, min: 2.4 },
{ k: 'street', t: 'line', c: 'street', m: 5, min: 1.8 },
{ k: 'road', t: 'line', c: 'roadCasing', m: 11, min: 3.6 },
{ k: 'road', t: 'line', c: 'road', m: 8.5, min: 2.8 },
]