Skip to content

The editor's own exports lost every row it wasn't showing - #64

Open
vhladiienko wants to merge 1 commit into
Open-Capture:mainfrom
vhladiienko:fix/editor-exports-whole-page
Open

vhladiienko wants to merge 1 commit into
Open-Capture:mainfrom
vhladiienko:fix/editor-exports-whole-page

Conversation

@vhladiienko

Copy link
Copy Markdown

What this changes

A capture longer than the editor's responsive budget opens trimmed ("Showing the first 22,791 rows of 28,916…"), and a page past shot-core's per-image cap opens as part 1 of N — while the banner tells the reader "nothing was dropped". That claim was only true of the popup's export buttons. The editor's own "Download PNG" and "Export PDF" wrote exactly the canvas as the file: a 1600×29000 capture exported as 28,589 rows, and a split capture exported as part 1 alone — which reads as data loss, the exact thing the banner promised against.

This PR makes the editor's exports reassemble the whole page:

  • loadImage() keeps the compressed capture blob plus its load dimensions — not a decoded bitmap, so nothing large stays pinned for the session.
  • At export time, when the canvas is still the untouched top-of-capture view, part 1 is recomposed at full height (original pixels, with the annotated canvas drawn over its top rows, so annotations land exactly where they were drawn) and output images 2..N are streamed from the background's blob store over a new read-only port (lastCaptureParts, same chunked-base64 pattern as the existing editor-image port, same Firefox private-window partitioning reason).
  • Download PNG saves every part — plain name when the capture never split, -page-i-of-N when it did, matching the popup's PNG answer. Export PDF builds one multi-page PDF through the existing imagesToPdf (a single image still goes through pngToPdf).
  • A crop or a frame redefines the image's boundary, so the canvas alone is then the image and the export is exactly its pixels — behaviour for a deliberate edit is unchanged.
  • If a device's canvas refuses the full-size compose, the export falls back to the visible rows and the status line says so and points at the popup, rather than quietly writing a shortened file. A missing stored part aborts the export with an error instead of a file that silently stops where the store did.
  • The split notice now vouches for the editor's own exports instead of pointing at the popup alone.

Two-way door, small blast radius: the popup's paths were already whole-page and are untouched, and the new editor path degrades to the old behaviour the moment the canvas stops being the untouched top of the capture.

How it was tested

  • npm run typecheck — clean.
  • npm test — 110 passed.
  • cargo test --workspace — 43 passed (36 shot-core incl. proptests, 7 shot-qa CLI).
  • Playwright e2e against the built extension, with the exported files' bytes parsed (PNG IHDR, PDF MediaBoxes), before and after:
Case Before After
1600×29000 capture (one PNG, editor trims the view) editor PNG = 1600×28589 editor PNG = 1600×29000; editor PDF = 1 page, MediaBox 21750 pt = all 29000 css rows
1200×40000 capture (2 output parts) editor export = part 1 only editor PNG = 2 files whose heights sum to 40000; editor PDF = 2 pages totalling 30000 pt (= 40000 css px at dpr 1)
  • e2e/too-long.spec.ts gained those assertions, so the partial-export bug now fails the suite instead of only failing a person. The popup's own exports were verified complete the same way (in both this tree and the released v1.0.1), which is why this PR leaves them alone.
  • Full e2e suite: 89 passed, 1 failed — watermark tool: tiled pattern respects location/orientation…, which fails identically on an unmodified checkout when the private watermark-premium submodule is absent (the build falls back to the draw-nothing stub). Environmental, not from this change.

Contributor Licence Agreement

This project is AGPL-3.0-or-later and is also distributed under app-store
terms that the AGPL cannot satisfy, which is only possible while one party
holds copyright in the whole work. See CLA.md for why.

You tick this once, on your first pull request; later ones are covered by it.

  • I have read CLA.md and I agree to it.

A capture too long for a responsive editor opens trimmed, and a page past
shot-core's per-image cap opens as part 1 of N — while the banner said
nothing was dropped. True only of the popup's exports: the editor's own
Download PNG and Export PDF wrote exactly the canvas, which for a
1600×29000 capture was a 28,589-row file, and for a split capture part 1
alone.

Exports now reassemble the whole page: part 1 recomposed at full height
from the kept compressed blob with the annotated canvas over its top
rows, parts 2..N streamed from the background's blob store over a new
read-only port. A crop or frame redefines the image, so the canvas alone
is then the export; a device that refuses the full-size compose falls
back to the visible rows and says so instead of passing a shortened file
off as the page. Popup paths were already whole-page and are untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant