1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #18275 from calixteman/fix_stamp_css_odd_spread

[Editor] Set the canvas in the stamp editor at the right position in odd spread mode
This commit is contained in:
calixteman 2024-06-18 18:51:25 +02:00 committed by GitHub
commit 45762c2f0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 0 deletions

View file

@ -751,4 +751,48 @@ describe("Stamp Editor", () => {
);
});
});
describe("Add a stamp in odd spread mode", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait(
"empty.pdf",
".annotationEditorLayer",
null,
null,
{
spreadModeOnLoad: 1,
}
);
});
afterAll(async () => {
await closePages(pages);
});
it("must check that the stamp has its canvas at the right position", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await switchToStamp(page);
await copyImage(page, "../images/firefox_logo.png", 0);
await page.waitForSelector(getEditorSelector(0));
await waitForSerialized(page, 1);
const canvasRect = await getRect(
page,
`${getEditorSelector(0)} canvas`
);
const stampRect = await getRect(page, getEditorSelector(0));
expect(
["x", "y", "width", "height"].every(
key => Math.abs(canvasRect[key] - stampRect[key]) <= 10
)
).toBeTrue();
})
);
});
});
});

View file

@ -508,6 +508,8 @@
width: 100%;
height: 100%;
margin: 0;
top: 0;
left: 0;
}
}

View file

@ -372,6 +372,12 @@ const PDFViewerApplication = {
params.get("supportscaretbrowsingmode") === "true"
);
}
if (params.has("spreadmodeonload")) {
AppOptions.set(
"spreadModeOnLoad",
parseInt(params.get("spreadmodeonload"))
);
}
}
},