Biete Bildausschnitt und Zoom für Bilder und Videos in Widgets an (ADR-70)

Redaktionelle Karten erhalten je Karte Fokus und Zoom, Einstieg, Bild und Text sowie
Premium-Karten zusätzlich einen Zoom (100 bis 250 Prozent, darunter entstünden leere
Ränder). Die Darstellung ist reines CSS um den Fokuspunkt; Video und Clip folgen dem
Ausschnitt. Die Regler zeigen beim Laden die Vorgabe statt 0 (FramingSlider).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-12-01 12:15:38 +01:00
1 parent 7f9534d289
commit 9353e2e38a
29 files changed
+641 -40

No files matched your search

+27
View File
@@ -276,3 +276,30 @@ @media (prefers-reduced-motion: reduce) {
.lf-bt__button { transition: none; }
.lf-bt__button:hover { transform: none; }
}
/*
* Zoom (ADR-70): Bild und Video liegen in einem Rahmen mit den Ecken und dem Schatten des Bilds und werden um den
* Fokuspunkt vergrößert; ab 100 % füllt das Bild den Rahmen, es entstehen keine Ränder. Ohne Zoom gibt es den Rahmen nicht.
*/
.lf-bt__frame {
position: relative;
display: block;
overflow: hidden;
border-radius: clamp(0.78rem, 1.8cqi, 1.3rem);
box-shadow: 0 10px 28px rgb(3 37 81 / 11%);
}
.lf-bt__frame > .lf-bt__image,
.lf-bt__frame > .lf-pc__clip {
border-radius: 0;
box-shadow: none;
object-position: var(--bt-focus-x) var(--bt-focus-y);
transform-origin: var(--bt-focus-x) var(--bt-focus-y);
scale: var(--bt-zoom, 1);
}
/* Zweispaltig füllt das Bild die Fläche neben dem Text (siehe oben); dann füllt der Rahmen sie. Ohne Text bestimmt das Bild seine Höhe selbst. */
@container lf-bt (min-width: 900px) {
.lf-bt__frame { position: absolute; inset: 0; }
.lf-bt--without-text .lf-bt__frame { position: relative; inset: auto; }
}
+26
View File
@@ -294,3 +294,29 @@ @media (prefers-reduced-motion: reduce) {
.lf-hero__button { transition: none; }
.lf-hero__button:hover { transform: none; }
}
/*
* Zoom (ADR-70): Foto und Video liegen in einem Rahmen, der den vergrößerten Ausschnitt abschneidet. Vergrößert wird um den
* Fokuspunkt, ab 100 % füllt das Bild den Rahmen, es entstehen keine Ränder. Ohne Zoom gibt es den Rahmen nicht.
*/
.lf-hero__frame {
position: absolute;
inset: 0;
z-index: -2;
overflow: hidden;
border-radius: inherit;
}
.lf-hero__frame > .lf-hero__photo,
.lf-hero__frame > .lf-hero__video {
z-index: auto;
border-radius: 0;
transform-origin: var(--lf-hero-focus-x) var(--lf-hero-focus-y);
scale: var(--lf-hero-zoom, 1);
}
@container lf-hero (max-width: 859.99px) {
.lf-hero__frame { position: relative; inset: auto; display: block; aspect-ratio: 16 / 9; }
.lf-hero__frame > .lf-hero__photo,
.lf-hero__frame > .lf-hero__video { position: absolute; inset: 0; block-size: 100%; aspect-ratio: auto; }
}
@@ -555,3 +555,17 @@ @media (prefers-reduced-motion: reduce) {
.lf-pc__clip-toggle:hover { transform: translate(-50%, -50%); }
}
/*
* Zoom (ADR-70): Bild und Clip werden um den Fokuspunkt vergrößert, der Bildbereich schneidet ab. Ab 100 % füllt das Bild
* den Rahmen, es entstehen keine Ränder. Die Klasse steht nur bei Zoom und nie bei „Ganzes Bild“.
*/
.lf-pc--zoom .lf-pc__visual {
overflow: hidden;
border-radius: var(--radius-card);
}
.lf-pc--zoom :is(.lf-pc__image, .lf-pc__clip) {
transform-origin: var(--pc-focus-x, 66%) var(--pc-focus-y, 45%);
scale: var(--pc-zoom, 1);
}
+1 -1
View File
@@ -30,7 +30,7 @@
])>
@if ($item['imageUrl'])
<div class="card-media">
<img class="card-image" src="{{ $item['imageUrl'] }}" @if (! empty($item['imageSrcset'])) srcset="{{ $item['imageSrcset'] }}" sizes="(min-width: 900px) 40vw, 100vw" @endif alt="" loading="lazy" decoding="async">
<img class="card-image" src="{{ $item['imageUrl'] }}" @if (! empty($item['imageSrcset'])) srcset="{{ $item['imageSrcset'] }}" sizes="{{ $item['imageSizes'] }}" @endif{!! $item['imageStyle'] !== null ? ' style="'.e($item['imageStyle']).'"' : '' !!} alt="" loading="lazy" decoding="async">
</div>
@endif
<div class="card-body">
+9 -2
View File
@@ -15,16 +15,23 @@
$loading = ! empty($first) ? 'loading="eager" fetchpriority="high"' : 'loading="lazy"';
$videoUrl = $layout === 'photo-split' ? ($video['url'] ?? null) : null;
$videoTitle = $video['title'] ?? '';
// Zoom (ADR-70): Foto und Video liegen dann in einem Rahmen, der den vergrößerten Ausschnitt abschneidet.
$zoomPercent = (int) ($zoom ?? 100);
$zoomed = $zoomPercent > 100 && $layout === 'photo-split' && ($imageUrl || $videoUrl !== null);
@endphp
<div class="lf-hero-host">
<div class="lf-hero lf-hero--{{ $layout }} lf-hero--height-{{ $heightClass }} lf-hero--accent-{{ $accent }}"
style="--lf-hero-focus-x: {{ $focus['x'] }}%; --lf-hero-focus-y: {{ $focus['y'] }}%"
style="--lf-hero-focus-x: {{ $focus['x'] }}%; --lf-hero-focus-y: {{ $focus['y'] }}%@if ($zoomed); --lf-hero-zoom: {{ $zoomPercent / 100 }}@endif"
@if ($videoUrl !== null) data-hero-video data-clip-src="{{ $videoUrl }}" data-clip-title="{{ $videoTitle }}" @endif>
@if ($zoomed)<div class="lf-hero__frame">@endif
@if ($layout === 'photo-split' && $imageUrl)
<img class="lf-hero__photo" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="100vw"@endif alt="{{ $imageAlt ?? '' }}" {!! $loading !!} decoding="async">
<img class="lf-hero__photo" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="{{ \App\Domain\Cms\Widgets\Support\ImageFraming::sizes('100vw', $zoomPercent) }}"@endif alt="{{ $imageAlt ?? '' }}" {!! $loading !!} decoding="async">
@endif
@if ($videoUrl !== null)
<video class="lf-hero__video" muted loop playsinline preload="none" disablepictureinpicture disableremoteplayback tabindex="-1" aria-hidden="true"></video>
@endif
@if ($zoomed)</div>@endif
@if ($videoUrl !== null)
<button type="button" class="lf-hero__video-toggle" aria-pressed="false" data-hero-toggle aria-label="Video abspielen: {{ $videoTitle }}" hidden>
<svg class="lf-hero__video-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true"><path class="lf-hero__video-play" d="M8 5.5v13l11-6.5z" fill="currentColor"/><path class="lf-hero__video-pause" d="M7 5h4v14H7zM13 5h4v14h-4z" fill="currentColor"/></svg>
<span class="lf-hero__video-label" aria-hidden="true">Video</span>
+7 -2
View File
@@ -13,6 +13,9 @@
$tag = \App\Domain\Cms\Widgets\Support\PremiumFields::headingTag($settings, ! empty($first));
$hasCopy = $hasCopy ?? true;
$imageShare = $imageShare ?? null;
// Zoom (ADR-70): Bild und Video liegen dann in einem Rahmen, der den vergrößerten Ausschnitt abschneidet.
$zoomPercent = (int) ($zoom ?? 100);
$zoomed = $zoomPercent > 100;
$clipUrl = $imageUrl ? ($video['url'] ?? null) : null;
$clipTitle = (string) ($video['title'] ?? '');
@endphp
@@ -27,7 +30,7 @@
'lf-bt--without-text' => ! $hasCopy,
'lf-bt--shared' => $imageShare !== null && $imageUrl && $hasCopy,
'lf-bt--share-'.$imageShare => $imageShare !== null && $imageUrl && $hasCopy,
]) style="--bt-focus-x: {{ $focus['x'] }}%; --bt-focus-y: {{ $focus['y'] }}%">
]) style="--bt-focus-x: {{ $focus['x'] }}%; --bt-focus-y: {{ $focus['y'] }}%@if ($zoomed); --bt-zoom: {{ $zoomPercent / 100 }}@endif">
@if ($hasCopy)
<div class="lf-bt__copy">
@php($lead = \App\Domain\Cms\Widgets\Support\HeadingAccent::lead($settings))
@@ -56,8 +59,10 @@
@endif
@if ($imageUrl)
<div class="lf-bt__media" @if ($clipUrl !== null) data-card-clip data-clip-src="{{ $clipUrl }}" data-clip-title="{{ $clipTitle }}" @endif>
<img class="lf-bt__image" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="100vw" @endif alt="{{ $imageAlt ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
@if ($zoomed)<div class="lf-bt__frame">@endif
<img class="lf-bt__image" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="{{ \App\Domain\Cms\Widgets\Support\ImageFraming::sizes('100vw', $zoomPercent) }}" @endif alt="{{ $imageAlt ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
@include('widgets.partials.card-clip', ['clipFullscreen' => $clipUrl !== null && ! empty($videoFullscreen)])
@if ($zoomed)</div>@endif
</div>
@endif
</div>
@@ -24,6 +24,9 @@
@elseif ($subject->public || $context->preview)
@php
$libraryImage = $imageUrl === null && $context->preview ? $subject->previewImage : null;
// Zoom (ADR-70) wirkt nur auf den Ausschnitt; „Ganzes Bild“ zeigt das Bild vollständig und wird nicht vergrößert.
$zoomPercent = ($fit ?? 'cover') === 'contain' ? 100 : (int) ($zoom ?? 100);
$zoomed = $zoomPercent > 100;
$panel = $imageUrl === null && $libraryImage === null ? $subject->visual : null;
$action = $show['action'] && $subject->url !== null ? ['url' => $subject->url, 'label' => $actionLabel] : null;
$meta = $show['meta'] ? $subject->meta : [];
@@ -49,10 +52,11 @@
'lf-pc--bare' => ! empty($bare),
'lf-pc--without-visual' => $imageUrl === null && $libraryImage === null && $panel === null,
'lf-pc--internal' => ! $subject->public,
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%">
'lf-pc--zoom' => $zoomed,
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%@if ($zoomed); --pc-zoom: {{ $zoomPercent / 100 }}@endif">
@if ($imageUrl !== null || $libraryImage !== null)
<div class="lf-pc__visual" @if ($clipUrl !== null) data-card-clip data-clip-src="{{ $clipUrl }}" data-clip-title="{{ $clipTitle }}" @endif>
<img class="lf-pc__image" src="{{ $imageUrl ?? $libraryImage }}" @if ($imageUrl !== null && ! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="(min-width: 900px) 50vw, 100vw" @endif alt="{{ $imageUrl !== null ? $alt : '' }}" loading="lazy" decoding="async">
<img class="lf-pc__image" src="{{ $imageUrl ?? $libraryImage }}" @if ($imageUrl !== null && ! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="{{ \App\Domain\Cms\Widgets\Support\ImageFraming::sizes('(min-width: 900px) 50vw, 100vw', $zoomPercent) }}" @endif alt="{{ $imageUrl !== null ? $alt : '' }}" loading="lazy" decoding="async">
@include('widgets.partials.card-clip')
@if ($show['kind'] && $subject->badge !== null && empty($bare))
<span class="lf-pc__badge">{{ $subject->badge }}</span>