feat(web): Karte/Satellit layer toggle on the Leaflet map #1105
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/map-satellite-layer-toggle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds an optional map/satellite layer switcher to
MapView.svelte, shown only when the tile provider suppliessatelliteTileUrlTemplate(otherwise the map renders exactly as before).Interaction
role="group"aria-label="Kartenstil"; each segment is a native button witharia-pressed, keyboard focusable with a visiblefocus-visible:ring-2 ring-emerald-300ring.bg-emerald-400 text-emerald-950), inactive segments aretext-neutral-400with a hover lift; the pill uses the established control language:rounded-2xl border border-neutral-700 bg-neutral-950/95 backdrop-blur shadow-xl shadow-black/35— same family as the split-view toggle.localStorageundermemories.map.layer('map' | 'satellite', read on mount with error guard) and applies to every MapView instance (map page, album map, media info panel) via a component-internal window event +storagelistener — no new props, no public API change.'satellite', the component silently falls back to the base layer.Placement
Bottom-right of the map frame at
bottom-10 right-3(z-[500]). Deliberately 40px above the bottom edge rather thanbottom-4: Leaflet's attribution bar hugs the bottom-right corner and grows to multiple lines once satellite credits (satelliteAttributionor fallback Esri, Maxar, Earthstar Geographics) are appended, sobottom-4would collide.bottom-10clears it in every case, keeps the control clear of the zoom control (topright) and the split-view toggle (right-3 top-[6.25rem]), and the 40px pill height is touch-friendly on mobile. The control is a sibling of the Leaflet container (not inside it), so map drags/scroll cannot be captured by it.Other changes
renderTileLayer()refactored to resolve the active template: base →tileUrlTemplate/attribution, satellite →satelliteTileUrlTemplate/satelliteAttribution(fallback attribution'Esri, Maxar, Earthstar Geographics'when empty).maxZoom: 19,detectRetina: truepreserved.provider.satelliteTileUrlTemplate,provider.satelliteAttribution, and the active layer.MapTileProviderSettingsgains the three optional satellite fields (identical block as the parallel backend lane, so the merge is trivial).Verification
npm run check(svelte-kit sync + svelte-check): 0 errors; 22 warnings, all pre-existing in unrelated route files — none in the changed files.