1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

[api-minor][Editor] When switching to editing mode, redraw pages containing editable annotations

Right now, editable annotations are using their own canvas when they're drawn, but
it induces several issues:
 - if the annotation has to be composed with the page then the canvas must be correctly
   composed with its parent. That means we should move the canvas under canvasWrapper
   and we should extract composing info from the drawing instructions...
   Currently it's the case with highlight annotations.
 - we use some extra memory for those canvas even if the user will never edit them, which
   the case for example when opening a pdf in Fenix.

So with this patch, all the editable annotations are drawn on the canvas. When the
user switches to editing mode, then the pages with some editable annotations are redrawn but
without them: they'll be replaced by their counterpart in the annotation editor layer.
This commit is contained in:
Calixte Denizet 2024-05-21 14:41:07 +02:00
parent 75129fd61a
commit 64635f3b35
13 changed files with 358 additions and 103 deletions

View file

@ -564,14 +564,14 @@ describe("Stamp Editor", () => {
for (let i = 0; i < pages1.length; i++) {
const [, page1] = pages1[i];
await page1.bringToFront();
await page1.click("#editorStamp");
await switchToStamp(page1);
await copyImage(page1, "../images/firefox_logo.png", 0);
await copy(page1);
const [, page2] = pages2[i];
await page2.bringToFront();
await page2.click("#editorStamp");
await switchToStamp(page2);
await paste(page2);