feat(ui): add bidirectional scroll-sync with flash animations

Paragraph click flashes the PDF annotation outline (1.5s fade).
Annotation click highlights the paragraph with a background flash.
Both directions scroll the target into view.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-07 11:25:23 +02:00
parent e089192d7a
commit 81b14e5026
4 changed files with 33 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ let {
blockNumbers = {},
activeAnnotationId = null,
dimmed = false,
flashAnnotationId = null,
onDraw,
onAnnotationClick
}: {
@@ -24,6 +25,7 @@ let {
blockNumbers?: Record<string, number>;
activeAnnotationId?: string | null;
dimmed?: boolean;
flashAnnotationId?: string | null;
onDraw: (rect: DrawRect) => void;
onAnnotationClick?: (id: string) => void;
} = $props();
@@ -110,6 +112,7 @@ const containerStyle = $derived(
<div
data-testid="annotation-{annotation.id}"
data-annotation
class:annotation-flash={flashAnnotationId === annotation.id}
role="button"
tabindex="0"
aria-label="Block anzeigen"
@@ -175,3 +178,20 @@ const containerStyle = $derived(
></div>
{/if}
</div>
<style>
@keyframes annotation-flash-anim {
0% {
outline: 3px solid rgba(0, 199, 177, 0.8);
outline-offset: 0px;
}
100% {
outline: 3px solid rgba(0, 199, 177, 0);
outline-offset: 2px;
}
}
.annotation-flash {
animation: annotation-flash-anim 1.5s ease-out;
}
</style>