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

@@ -54,6 +54,7 @@ let transcribeMode = $state(false);
let panelMode = $state<'read' | 'edit'>('read');
let activeAnnotationId = $state<string | null>(null);
let highlightBlockId = $state<string | null>(null);
let flashAnnotationId = $state<string | null>(null);
// ── Transcription blocks ─────────────────────────────────────────────────────
@@ -177,6 +178,10 @@ async function handleAnnotationClick(annotationId: string) {
function handleParagraphClick(annotationId: string) {
activeAnnotationId = annotationId;
flashAnnotationId = annotationId;
setTimeout(() => {
flashAnnotationId = null;
}, 1500);
}
// Load blocks when transcribe mode is entered and set default panel mode
@@ -241,6 +246,7 @@ onMount(() => {
blockNumbers={blockNumbers}
annotationReloadKey={annotationReloadKey}
annotationsDimmed={transcribeMode && panelMode === 'read'}
flashAnnotationId={flashAnnotationId}
bind:activeAnnotationId={activeAnnotationId}
onAnnotationClick={handleAnnotationClick}
onTranscriptionDraw={createBlockFromDraw}