fix(stellungnahme): Mini-Map mobile square + Gebiet zentriert (fitBoundsPadding-Prop)
Deploy / verify (push) Successful in 1m5s
Deploy / deploy (push) Successful in 1m12s

This commit is contained in:
Peter Meier
2026-05-30 11:25:36 +02:00
parent bd67f0c568
commit 3f39b5b1a8
2 changed files with 18 additions and 3 deletions
+16 -2
View File
@@ -12,6 +12,7 @@
hiddenStatuses = [],
hiddenRings = [],
fitBoundsMaxZoom = 11,
fitBoundsPadding = null,
}: {
areas: WindArea[];
onselect: (area: WindArea | null, center: [number, number] | null) => void;
@@ -20,6 +21,10 @@
hiddenStatuses?: string[];
hiddenRings?: string[];
fitBoundsMaxZoom?: number;
/** Wenn gesetzt: symmetrisches [x,y]-Padding für fitBounds (z.B. Mini-Map
* ohne Panel). Default null = panel-aware Padding (großer Bottom-/Side-
* Bereich für Detail-Drawer in der vollwertigen Karte). */
fitBoundsPadding?: [number, number] | null;
} = $props();
const t = useTranslate();
@@ -166,9 +171,18 @@
if (zoom && prev !== name) {
const desktop = window.innerWidth >= 640;
const pad: { paddingTopLeft: [number, number]; paddingBottomRight: [number, number] } =
fitBoundsPadding
? {
paddingTopLeft: fitBoundsPadding,
paddingBottomRight: fitBoundsPadding,
}
: {
paddingTopLeft: [40, 40],
paddingBottomRight: [desktop ? 320 : 40, desktop ? 40 : 300],
};
map!.fitBounds((layer as import("leaflet").Polygon).getBounds(), {
paddingTopLeft: [40, 40],
paddingBottomRight: [desktop ? 320 : 40, desktop ? 40 : 300],
...pad,
maxZoom: fitBoundsMaxZoom,
});
}