diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 6004793b..6d663f90 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -258,5 +258,7 @@ "doc_panel_annotate": "Annotieren", "doc_panel_annotate_stop": "Fertig", "doc_panel_annotation_thread_title": "Annotation", - "doc_panel_discussion_annotation_tab": "Annotation · Seite {page}" + "doc_panel_discussion_annotation_tab": "Annotation · Seite {page}", + "pdf_annotations_show": "Annotierungen anzeigen", + "pdf_annotations_hide": "Annotierungen verbergen" } diff --git a/frontend/messages/en.json b/frontend/messages/en.json index c4669686..92ce9ceb 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -258,5 +258,7 @@ "doc_panel_annotate": "Annotate", "doc_panel_annotate_stop": "Done", "doc_panel_annotation_thread_title": "Annotation", - "doc_panel_discussion_annotation_tab": "Annotation · Page {page}" + "doc_panel_discussion_annotation_tab": "Annotation · Page {page}", + "pdf_annotations_show": "Show annotations", + "pdf_annotations_hide": "Hide annotations" } diff --git a/frontend/messages/es.json b/frontend/messages/es.json index 7e9ff8e8..8e3dd84b 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -258,5 +258,7 @@ "doc_panel_annotate": "Anotar", "doc_panel_annotate_stop": "Listo", "doc_panel_annotation_thread_title": "Anotación", - "doc_panel_discussion_annotation_tab": "Anotación · Página {page}" + "doc_panel_discussion_annotation_tab": "Anotación · Página {page}", + "pdf_annotations_show": "Mostrar anotaciones", + "pdf_annotations_hide": "Ocultar anotaciones" } diff --git a/frontend/src/lib/components/PdfViewer.svelte b/frontend/src/lib/components/PdfViewer.svelte index 5f15bc9a..6c3deb33 100644 --- a/frontend/src/lib/components/PdfViewer.svelte +++ b/frontend/src/lib/components/PdfViewer.svelte @@ -3,6 +3,7 @@ import { onMount } from 'svelte'; import { SvelteMap } from 'svelte/reactivity'; import type { PDFDocumentProxy, PDFPageProxy, RenderTask } from 'pdfjs-dist'; import AnnotationLayer from './AnnotationLayer.svelte'; +import { m } from '$lib/paraglide/messages.js'; let { url, @@ -55,6 +56,7 @@ type Annotation = { let annotations = $state([]); let annotateColor = $state('#ffff00'); let commentCounts = new SvelteMap(); +let showAnnotations = $state(true); onMount(async () => { // Dynamic import keeps pdfjs out of the SSR bundle entirely @@ -403,6 +405,53 @@ function zoomOut() { {/if} + + {#if annotations.length > 0} + + {/if} +
{#if loading} @@ -424,15 +473,17 @@ function zoomOut() { class="textLayer" style="position: absolute; top: 0; left: 0; overflow: hidden; pointer-events: none; line-height: 1;" >
- a.pageNumber === currentPage)} - canAnnotate={annotateMode} - color={annotateColor} - onDraw={handleAnnotationDraw} - onDelete={handleAnnotationDelete} - commentCounts={Object.fromEntries(commentCounts)} - onAnnotationClick={handleAnnotationClick} - /> + {#if showAnnotations} + a.pageNumber === currentPage)} + canAnnotate={annotateMode} + color={annotateColor} + onDraw={handleAnnotationDraw} + onDelete={handleAnnotationDelete} + commentCounts={Object.fromEntries(commentCounts)} + onAnnotationClick={handleAnnotationClick} + /> + {/if} {/if}