aktueller stand
This commit is contained in:
@@ -0,0 +1,598 @@
|
||||
---
|
||||
import { partners, locatedPartners } from "../lib/partners";
|
||||
import {
|
||||
STATES,
|
||||
DETAIL_STATES,
|
||||
VIEWS,
|
||||
MAP_WIDTH,
|
||||
MAP_HEIGHT,
|
||||
HAMBURG,
|
||||
RIVERS,
|
||||
WATER,
|
||||
REGION_LABELS,
|
||||
project,
|
||||
type MapView,
|
||||
} from "../lib/germanyMap";
|
||||
|
||||
interface Props {
|
||||
view?: MapView;
|
||||
eyebrow?: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
const { view = "hamburg", eyebrow = "Vertrauen", title = "Unsere Partner" } = Astro.props;
|
||||
|
||||
const [vx, vy, vw, vh] = VIEWS[view].split(" ").map(Number);
|
||||
|
||||
// Position jedes Standorts als Prozentwert im Kartenrahmen. Der Container
|
||||
// bekommt exakt das aspect-ratio des viewBox, deshalb stimmen die Prozente
|
||||
// unabhängig von der Rendergröße.
|
||||
const pins = locatedPartners
|
||||
.map((partner) => {
|
||||
const { x, y } = project(partner.location.lat, partner.location.lng);
|
||||
return {
|
||||
id: partner.file.replace(/\.[a-z]+$/i, ""),
|
||||
partner,
|
||||
left: ((x - vx) / vw) * 100,
|
||||
top: ((y - vy) / vh) * 100,
|
||||
};
|
||||
})
|
||||
.filter((p) => p.left >= 0 && p.left <= 100 && p.top >= 0 && p.top <= 100);
|
||||
|
||||
// Westliche Standorte hängen links, östliche rechts — dadurch kreuzen sich
|
||||
// die Verbindungslinien nicht. Innerhalb der Spalte nach Nord-Süd sortiert.
|
||||
const sorted = [...pins].sort((a, b) => a.left - b.left);
|
||||
const half = Math.ceil(sorted.length / 2);
|
||||
const leftColumn = sorted.slice(0, half).sort((a, b) => a.top - b.top);
|
||||
const rightColumn = sorted.slice(half).sort((a, b) => a.top - b.top);
|
||||
|
||||
// Alle Standorte liegen in Hamburg; das Bundesland wird deshalb als
|
||||
// einziges hervorgehoben, die Nachbarn geben nur Kontext.
|
||||
const highlighted = new Set(["Hamburg"]);
|
||||
const withoutLocation = partners.filter((p) => !p.location);
|
||||
---
|
||||
|
||||
<!--
|
||||
Partnerkarte: echte Bundesland-Umrisse (siehe lib/germanyMap.ts), ein
|
||||
Bienenstock je hinterlegtem Standort und eine Verbindungslinie zum Logo.
|
||||
Alles kommt aus lib/partners.ts — ein neuer Eintrag mit `location` erzeugt
|
||||
Nadel, Linie und Logo automatisch; ohne `location` erscheint der Partner
|
||||
nur in der Logo-Wand darunter.
|
||||
-->
|
||||
<section class="brand-section relative overflow-hidden bg-brand-surface py-[calc(var(--section-y)*0.85)]">
|
||||
<div class="absolute inset-0 honeycomb-bg opacity-35" aria-hidden="true"></div>
|
||||
|
||||
<div class="relative mx-auto max-w-[92rem] px-[var(--gutter)]">
|
||||
<div class="reveal flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<span class="section-label section-label-green">{eyebrow}</span>
|
||||
<h2 class="mt-5">{title}</h2>
|
||||
</div>
|
||||
<p class="text-[0.9375rem] text-brand-text-muted sm:pb-2 sm:text-right">
|
||||
<span class="font-medium tabular-nums text-brand-ink">{partners.length}</span> Unternehmen und Hotels
|
||||
<br class="hidden sm:block" />mit Bienen vor Ort
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="partner-map" class="reveal relative mt-14" style="--delay: 0.08s">
|
||||
<!-- Verbindungslinien: per JS gezeichnet, weil die Logo-Positionen erst
|
||||
im Layout feststehen. Ohne JS fehlen nur die Linien. -->
|
||||
<svg
|
||||
id="partner-map-links"
|
||||
class="pointer-events-none absolute inset-0 hidden h-full w-full lg:block"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</svg>
|
||||
|
||||
<div class="grid items-center gap-8 lg:grid-cols-[minmax(0,0.85fr)_minmax(0,3.2fr)_minmax(0,0.85fr)] lg:gap-8">
|
||||
<ul class="hidden flex-col gap-2 lg:flex">
|
||||
{leftColumn.map((pin) => (
|
||||
<li>
|
||||
<button type="button" class="map-logo map-logo-left" data-partner={pin.id}>
|
||||
<img src={`/images/partners/${pin.partner.file}`} alt={`Logo ${pin.partner.name}`} loading="lazy" />
|
||||
<span class="map-logo-place">{pin.partner.location.label}</span>
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<div
|
||||
class="map-panel relative overflow-hidden rounded-[var(--radius-card)] shadow-md ring-1 ring-brand-border"
|
||||
style={`aspect-ratio: ${vw} / ${vh}`}
|
||||
>
|
||||
<svg
|
||||
viewBox={VIEWS[view]}
|
||||
class="h-full w-full"
|
||||
role="img"
|
||||
aria-label={`Karte mit ${pins.length} Bienenstandorten in und um Hamburg`}
|
||||
>
|
||||
<defs>
|
||||
{DETAIL_STATES.map((state) => <path id={`st-${state.id}`} d={state.d} />)}
|
||||
</defs>
|
||||
|
||||
<g class="map-backdrop" aria-hidden="true">
|
||||
{DETAIL_STATES.map((state) => <use href={`#st-${state.id}`} />)}
|
||||
</g>
|
||||
|
||||
{DETAIL_STATES.map((state) => (
|
||||
<use
|
||||
href={`#st-${state.id}`}
|
||||
class:list={["map-state", highlighted.has(state.name) && "map-state-active"]}
|
||||
/>
|
||||
))}
|
||||
|
||||
<path d={RIVERS} class="map-river" />
|
||||
<path d={WATER} class="map-water" />
|
||||
|
||||
{DETAIL_STATES.map((state) => (
|
||||
<use
|
||||
href={`#st-${state.id}`}
|
||||
class:list={["map-border", highlighted.has(state.name) && "map-border-active"]}
|
||||
/>
|
||||
))}
|
||||
|
||||
{REGION_LABELS.map((label) => (
|
||||
<text x={label.x} y={label.y} class="map-label">{label.name}</text>
|
||||
))}
|
||||
</svg>
|
||||
|
||||
<svg
|
||||
class="map-inset"
|
||||
viewBox={`0 0 ${MAP_WIDTH} ${MAP_HEIGHT}`}
|
||||
role="img"
|
||||
aria-label="Übersicht: Lage des Kartenausschnitts in Deutschland"
|
||||
>
|
||||
{STATES.map((state) => (
|
||||
<path d={state.d} class:list={["inset-state", state.name === "Hamburg" && "inset-state-active"]} />
|
||||
))}
|
||||
<circle cx={HAMBURG.x} cy={HAMBURG.y} r="34" class="inset-halo" />
|
||||
<circle cx={HAMBURG.x} cy={HAMBURG.y} r="15" class="inset-dot" />
|
||||
</svg>
|
||||
|
||||
{pins.map((pin) => (
|
||||
<button
|
||||
type="button"
|
||||
class="map-pin"
|
||||
data-partner={pin.id}
|
||||
style={`left: ${pin.left.toFixed(2)}%; top: ${pin.top.toFixed(2)}%`}
|
||||
>
|
||||
<span class="sr-only">{pin.partner.name}, {pin.partner.location.label}</span>
|
||||
<span class="map-glow" aria-hidden="true"></span>
|
||||
<svg viewBox="0 0 24 26" aria-hidden="true" class="map-hive">
|
||||
<ellipse cx="12" cy="23.4" rx="7.2" ry="1.5" class="map-hive-shadow" />
|
||||
<rect x="7.6" y="4" width="8.8" height="3.9" rx="1.95" />
|
||||
<rect x="5.6" y="7.9" width="12.8" height="3.9" rx="1.95" />
|
||||
<rect x="4" y="11.8" width="16" height="3.9" rx="1.95" />
|
||||
<rect x="3.2" y="15.7" width="17.6" height="4.1" rx="2.05" />
|
||||
<path d="M10.4 19.8a1.6 1.6 0 0 1 3.2 0z" class="map-hive-entrance" />
|
||||
</svg>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<ul class="hidden flex-col gap-2 lg:flex">
|
||||
{rightColumn.map((pin) => (
|
||||
<li>
|
||||
<button type="button" class="map-logo map-logo-right" data-partner={pin.id}>
|
||||
<img src={`/images/partners/${pin.partner.file}`} alt={`Logo ${pin.partner.name}`} loading="lazy" />
|
||||
<span class="map-logo-place">{pin.partner.location.label}</span>
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Unter lg gibt es keine Spalten neben der Karte; dort stehen alle
|
||||
verorteten Partner als Liste unter der Karte. -->
|
||||
<ul class="mt-10 grid grid-cols-2 gap-3 sm:grid-cols-3 lg:hidden">
|
||||
{pins.map((pin) => (
|
||||
<li class="flex flex-col items-center gap-2 rounded-[var(--radius-inner)] bg-brand-surface-strong p-4 ring-1 ring-brand-border">
|
||||
<img
|
||||
src={`/images/partners/${pin.partner.file}`}
|
||||
alt={`Logo ${pin.partner.name}`}
|
||||
loading="lazy"
|
||||
class="h-10 w-full object-contain"
|
||||
/>
|
||||
<span class="text-center text-xs text-brand-text-muted">{pin.partner.location.label}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{withoutLocation.length > 0 && (
|
||||
<div class="mt-16 border-t border-brand-border pt-10">
|
||||
<p class="reveal text-sm text-brand-text-muted">
|
||||
Weitere Partner
|
||||
<span class="tabular-nums"> ({withoutLocation.length})</span>
|
||||
</p>
|
||||
<ul class="reveal mt-6 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-8">
|
||||
{withoutLocation.map((partner) => (
|
||||
<li class="flex aspect-[3/2] items-center justify-center rounded-[var(--radius-inner)] bg-brand-surface-strong p-4 ring-1 ring-brand-border">
|
||||
<img
|
||||
src={`/images/partners/${partner.file}`}
|
||||
alt={`Logo ${partner.name}`}
|
||||
title={partner.name}
|
||||
loading="lazy"
|
||||
class="max-h-full w-full object-contain"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
/* Die vereinfachten Länderumrisse liegen nicht exakt aufeinander. Diese
|
||||
* Grundebene zeichnet alle Flächen einmal mit fettem Strich vor, damit
|
||||
* durch die Lücken nicht der Seitenhintergrund scheint. */
|
||||
.map-backdrop use {
|
||||
fill: #e4dccb;
|
||||
stroke: #e4dccb;
|
||||
stroke-width: 0.45;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.map-state {
|
||||
fill: #e4dccb;
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
.map-state-active {
|
||||
fill: #f7e5bd;
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
/* Elbe, Hafenbecken und Alster — ohne sie ist der Umriss nicht als
|
||||
* Hamburg lesbar. */
|
||||
/* Der Fluss ist ein Strich: eine durchgehende Linie statt einer Kette
|
||||
* von Uferflächen mit Lücken dazwischen. */
|
||||
.map-river {
|
||||
fill: none;
|
||||
stroke: #a7c6d6;
|
||||
stroke-width: 2.4;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.map-water {
|
||||
fill: #a7c6d6;
|
||||
stroke: none;
|
||||
}
|
||||
|
||||
/* Grenzen liegen über dem Wasser, damit die Stadtgrenze auch dort
|
||||
* durchläuft, wo die Elbe sie schneidet. */
|
||||
/* Benachbarte Bundesländer teilen sich ihre Grenzlinien — bei kräftigem
|
||||
* Strich legen sich die Linien übereinander und bilden ein breites Band.
|
||||
* Deshalb dünn und in einem dunkleren Ton statt in Weiß. */
|
||||
.map-border {
|
||||
fill: none;
|
||||
stroke: #cfc5b0;
|
||||
stroke-width: 0.35;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
/* Die Stadtgrenze trägt die Aussage und muss sich deshalb klar von den
|
||||
* Nachbargrenzen abheben. */
|
||||
.map-border-active {
|
||||
stroke: #a8781f;
|
||||
stroke-width: 0.5;
|
||||
stroke-opacity: 0.95;
|
||||
}
|
||||
|
||||
.map-label {
|
||||
fill: #9b8f77;
|
||||
font-family: var(--font-sans);
|
||||
font-size: 3.4px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.16px;
|
||||
text-anchor: middle;
|
||||
text-transform: uppercase;
|
||||
paint-order: stroke;
|
||||
stroke: #efe9dd;
|
||||
stroke-width: 1.1px;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.map-panel {
|
||||
background:
|
||||
radial-gradient(120% 100% at 50% 0%, #f3eee3 0%, #e9e2d3 65%, #e2dacb 100%);
|
||||
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.7);
|
||||
}
|
||||
|
||||
/* --- Übersichtskarte Deutschland --- */
|
||||
.map-inset {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: clamp(3.5rem, 7%, 5rem);
|
||||
height: auto;
|
||||
padding: 0.5rem;
|
||||
border-radius: var(--radius-inner);
|
||||
background: rgb(250 248 243 / 0.92);
|
||||
outline: 1px solid var(--color-brand-border);
|
||||
outline-offset: -1px;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.inset-state {
|
||||
fill: #b3a68a;
|
||||
stroke: #faf8f3;
|
||||
stroke-width: 4;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.inset-state-active {
|
||||
fill: var(--color-brand-ink);
|
||||
}
|
||||
|
||||
.inset-halo {
|
||||
fill: var(--color-brand-primary);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.inset-dot {
|
||||
fill: var(--color-brand-primary);
|
||||
stroke: #faf8f3;
|
||||
stroke-width: 5;
|
||||
}
|
||||
|
||||
/* --- Bienenstock --- */
|
||||
.map-pin {
|
||||
position: absolute;
|
||||
translate: -50% -100%;
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
cursor: pointer;
|
||||
transition: translate 0.35s var(--ease-spring);
|
||||
}
|
||||
|
||||
.map-hive {
|
||||
position: relative;
|
||||
width: clamp(1.15rem, 1.7vw, 1.6rem);
|
||||
height: auto;
|
||||
fill: var(--color-brand-primary);
|
||||
filter: drop-shadow(0 1px 1.5px rgb(90 60 0 / 0.45));
|
||||
transition: scale 0.35s var(--ease-spring);
|
||||
}
|
||||
|
||||
.map-hive-entrance {
|
||||
fill: #1f1a13;
|
||||
}
|
||||
|
||||
.map-hive-shadow {
|
||||
fill: #6b4a05;
|
||||
opacity: 0.22;
|
||||
}
|
||||
|
||||
/* Weicher Schein, damit dicht beieinander liegende Stöcke als Gruppe
|
||||
* lesbar bleiben statt als Klumpen. */
|
||||
.map-glow {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 45%;
|
||||
width: 2.6rem;
|
||||
height: 2.6rem;
|
||||
translate: -50% -50%;
|
||||
border-radius: 999px;
|
||||
background: radial-gradient(circle, rgb(248 172 17 / 0.3), transparent 68%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s var(--ease-spring);
|
||||
}
|
||||
|
||||
.map-pin:hover .map-glow,
|
||||
.map-pin:focus-visible .map-glow,
|
||||
.map-pin.is-active .map-glow {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.map-pin:focus-visible,
|
||||
.map-pin.is-active {
|
||||
translate: -50% calc(-100% - 4px);
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.map-pin:focus-visible .map-hive,
|
||||
.map-pin.is-active .map-hive {
|
||||
scale: 1.18;
|
||||
}
|
||||
|
||||
/* --- Logos neben der Karte --- */
|
||||
.map-logo {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
border-radius: var(--radius-inner);
|
||||
background: var(--color-brand-surface-strong);
|
||||
padding: 0.7rem 0.85rem;
|
||||
text-align: left;
|
||||
box-shadow: var(--shadow-2xs);
|
||||
outline: 1px solid var(--color-brand-border);
|
||||
outline-offset: -1px;
|
||||
transition:
|
||||
box-shadow 0.35s var(--ease-spring),
|
||||
transform 0.35s var(--ease-spring);
|
||||
}
|
||||
|
||||
.map-logo-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.map-logo img {
|
||||
height: 1.9rem;
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.map-logo-left img {
|
||||
object-position: left center;
|
||||
}
|
||||
|
||||
.map-logo-right img {
|
||||
object-position: right center;
|
||||
}
|
||||
|
||||
.map-logo-place {
|
||||
font-size: 0.6875rem;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--color-brand-text-muted);
|
||||
}
|
||||
|
||||
.map-logo:hover,
|
||||
.map-logo:focus-visible,
|
||||
.map-logo.is-active {
|
||||
outline-color: var(--color-brand-primary);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.map-logo-left.is-active {
|
||||
transform: translateX(4px);
|
||||
}
|
||||
|
||||
.map-logo-right.is-active {
|
||||
transform: translateX(-4px);
|
||||
}
|
||||
|
||||
/* Auf Touch feuert :hover beim Antippen und bleibt kleben. */
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.map-pin:hover {
|
||||
translate: -50% calc(-100% - 4px);
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.map-pin:hover .map-hive {
|
||||
scale: 1.18;
|
||||
}
|
||||
|
||||
.map-logo-left:hover {
|
||||
transform: translateX(4px);
|
||||
}
|
||||
|
||||
.map-logo-right:hover {
|
||||
transform: translateX(-4px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.map-pin,
|
||||
.map-hive,
|
||||
.map-logo {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
/* Zuordnung bleibt über Ring, Schein und Linienfarbe lesbar — nur die
|
||||
* Verschiebungen entfallen. */
|
||||
.map-pin:hover,
|
||||
.map-pin:focus-visible,
|
||||
.map-pin.is-active {
|
||||
translate: -50% -100%;
|
||||
}
|
||||
|
||||
.map-logo-left:hover,
|
||||
.map-logo-left.is-active,
|
||||
.map-logo-right:hover,
|
||||
.map-logo-right.is-active {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.map-pin:hover .map-hive,
|
||||
.map-pin:focus-visible .map-hive,
|
||||
.map-pin.is-active .map-hive {
|
||||
scale: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style is:global>
|
||||
/* Die Verbindungslinien entstehen zur Laufzeit per JS und tragen daher
|
||||
* kein Scope-Attribut — diese Regeln müssen global gelten. */
|
||||
#partner-map-links path {
|
||||
transition:
|
||||
stroke 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
stroke-opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
stroke-width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
|
||||
#partner-map-links path.is-active {
|
||||
stroke: var(--color-brand-primary);
|
||||
stroke-width: 2;
|
||||
stroke-opacity: 1;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
#partner-map-links path {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
document.addEventListener("astro:page-load", () => {
|
||||
const root = document.getElementById("partner-map");
|
||||
const svg = document.getElementById("partner-map-links");
|
||||
if (!root || !svg) return;
|
||||
|
||||
const pins = [...root.querySelectorAll<HTMLElement>(".map-pin")];
|
||||
const logos = [...root.querySelectorAll<HTMLElement>(".map-logo")];
|
||||
if (pins.length === 0) return;
|
||||
|
||||
function draw() {
|
||||
const box = root!.getBoundingClientRect();
|
||||
svg!.setAttribute("viewBox", `0 0 ${box.width} ${box.height}`);
|
||||
svg!.replaceChildren();
|
||||
|
||||
for (const logo of logos) {
|
||||
const id = logo.dataset.partner;
|
||||
const pin = pins.find((p) => p.dataset.partner === id);
|
||||
if (!pin) continue;
|
||||
|
||||
const l = logo.getBoundingClientRect();
|
||||
const p = pin.getBoundingClientRect();
|
||||
const rechts = logo.classList.contains("map-logo-right");
|
||||
|
||||
// Start an der Innenkante des Logos, Ziel am Fuß des Bienenstocks.
|
||||
const x1 = (rechts ? l.left : l.right) - box.left;
|
||||
const y1 = l.top + l.height / 2 - box.top;
|
||||
const x2 = p.left + p.width / 2 - box.left;
|
||||
const y2 = p.bottom - box.top;
|
||||
|
||||
// Kurzes waagerechtes Stück am Logo, dann eine weiche Kurve — so
|
||||
// bleibt die Zuordnung ablesbar, auch wenn Linien nah beieinander
|
||||
// liegen.
|
||||
const stub = rechts ? -14 : 14;
|
||||
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
path.setAttribute(
|
||||
"d",
|
||||
`M${x1} ${y1}H${x1 + stub}C${(x1 + x2) / 2} ${y1} ${(x1 + x2) / 2} ${y2} ${x2} ${y2}`
|
||||
);
|
||||
path.setAttribute("fill", "none");
|
||||
path.setAttribute("stroke", "#8a5e05");
|
||||
path.setAttribute("stroke-width", "1");
|
||||
path.setAttribute("stroke-opacity", "0.35");
|
||||
path.dataset.partner = id ?? "";
|
||||
svg!.append(path);
|
||||
}
|
||||
}
|
||||
|
||||
function setActive(id: string | null) {
|
||||
for (const el of [...pins, ...logos, ...svg!.querySelectorAll<SVGElement>("path")]) {
|
||||
el.classList.toggle("is-active", id != null && el.dataset.partner === id);
|
||||
}
|
||||
}
|
||||
|
||||
for (const el of [...pins, ...logos]) {
|
||||
const id = el.dataset.partner ?? null;
|
||||
el.addEventListener("mouseenter", () => setActive(id));
|
||||
el.addEventListener("focus", () => setActive(id));
|
||||
el.addEventListener("mouseleave", () => setActive(null));
|
||||
el.addEventListener("blur", () => setActive(null));
|
||||
}
|
||||
|
||||
draw();
|
||||
// Bilder laden asynchron und verändern die Logo-Höhen — danach neu zeichnen.
|
||||
new ResizeObserver(draw).observe(root);
|
||||
window.addEventListener("resize", draw, { passive: true });
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user