From 11f37b7921a3f9ab2e44853770a7846daf79ab7f Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 11 Aug 2026 11:49:47 +0200 Subject: [PATCH] Let each visibility switch hide only its own thing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The margin notes hung off both switches: `hidden: hideInk || !showPins`, so turning off the drawing took the markers and their column with it — one switch turning off both of the things the pair exists to separate. The checks look at what is actually visible — the ink layer's opacity, how many markers are on the page, whether the column is there — and test both directions separately, which is what the old code failed. Co-Authored-By: Claude Opus 5 --- e2e/pdf.mjs | 28 +++++++++++++++++++++++++ frontend/src/features/pdf/PdfViewer.jsx | 6 +++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/e2e/pdf.mjs b/e2e/pdf.mjs index 8bfae0e..93baca6 100644 --- a/e2e/pdf.mjs +++ b/e2e/pdf.mjs @@ -759,6 +759,34 @@ try { await p.locator("[data-pdf-mode]").click(); await p.waitForTimeout(700); + /* Each switch hides its own thing and nothing else. They shared a condition + once, so hiding the drawing took the markers and their column with it — + one switch turning off both of the things the pair exists to separate. */ + const drawingShows = async () => + (await p.locator('[data-pdf-ink="1"]').evaluate((c) => getComputedStyle(c).opacity)) !== "0"; + const marginNotesShow = async () => (await p.locator("[data-pin]").count()) > 0; + + check((await drawingShows()) && (await marginNotesShow()), "both are showing to begin with"); + + await p.locator("[data-pdf-hide-ink]").click(); + await p.waitForTimeout(900); + check(!(await drawingShows()), "hiding the drawing hides the drawing"); + check(await marginNotesShow(), "and leaves the margin notes alone"); + check( + (await p.locator("[data-pdf-margin]").count()) > 0, + "including their column", + String(await p.locator("[data-pdf-margin]").count()) + ); + await p.locator("[data-pdf-hide-ink]").click(); + await p.waitForTimeout(900); + + await p.locator("[data-pdf-show-pins]").click(); + await p.waitForTimeout(900); + check(!(await marginNotesShow()), "hiding the margin notes hides the margin notes"); + check(await drawingShows(), "and leaves the drawing alone"); + await p.locator("[data-pdf-show-pins]").click(); + await p.waitForTimeout(900); + check((await p.locator("[data-pdf-show-pins]").count()) === 1, "the margin notes can be hidden"); await p.locator("[data-pdf-show-pins]").click(); await p.waitForTimeout(1200); diff --git a/frontend/src/features/pdf/PdfViewer.jsx b/frontend/src/features/pdf/PdfViewer.jsx index f1713ab..1abeb98 100644 --- a/frontend/src/features/pdf/PdfViewer.jsx +++ b/frontend/src/features/pdf/PdfViewer.jsx @@ -804,7 +804,11 @@ export function PdfViewer({ note, dark, onUpdate, onPagesReady, notesToggle, foc notes: notesForPage(ink, i + 1), placing, openId: openPin, - hidden: hideInk || !showPins, + // Only the margin-note switch decides this. It used to read + // `hideInk || !showPins`, so hiding the drawing took the + // markers and their column with it — one switch turning off + // both things the pair was meant to separate. + hidden: !showPins, withMargin, onOpen: setOpenPin, onPlace: placeNote,