windkarte: scroll map into view when URL hash selects an area
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,7 @@ let areas = $state<WindArea[]>([]);
|
|||||||
let hiddenStatuses = $state<string[]>(["rechtskraeftig"]);
|
let hiddenStatuses = $state<string[]>(["rechtskraeftig"]);
|
||||||
let hiddenRings = $state<string[]>([]);
|
let hiddenRings = $state<string[]>([]);
|
||||||
let mapActive = $state(false);
|
let mapActive = $state(false);
|
||||||
|
let blockEl: HTMLDivElement;
|
||||||
|
|
||||||
function toggleStatus(status: string) {
|
function toggleStatus(status: string) {
|
||||||
hiddenStatuses = hiddenStatuses.includes(status)
|
hiddenStatuses = hiddenStatuses.includes(status)
|
||||||
@@ -87,10 +88,14 @@ let areas = $state<WindArea[]>([]);
|
|||||||
// Map renders without CMS metadata — GeoJSON tooltips still work
|
// Map renders without CMS metadata — GeoJSON tooltips still work
|
||||||
}
|
}
|
||||||
mapReady = true;
|
mapReady = true;
|
||||||
|
if (initialGebietsNr) {
|
||||||
|
setTimeout(() => blockEl?.scrollIntoView({ behavior: "smooth", block: "start" }), 100);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
bind:this={blockEl}
|
||||||
class="wind-map-block {layoutClasses}"
|
class="wind-map-block {layoutClasses}"
|
||||||
data-block="WindMap"
|
data-block="WindMap"
|
||||||
data-block-type="wind_map"
|
data-block-type="wind_map"
|
||||||
|
|||||||
Reference in New Issue
Block a user