diff --git a/test/integration/stamp_editor_spec.mjs b/test/integration/stamp_editor_spec.mjs index 82979e6f8..62438dc6d 100644 --- a/test/integration/stamp_editor_spec.mjs +++ b/test/integration/stamp_editor_spec.mjs @@ -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(); + }) + ); + }); + }); }); diff --git a/web/annotation_editor_layer_builder.css b/web/annotation_editor_layer_builder.css index 346427df9..0fa433e82 100644 --- a/web/annotation_editor_layer_builder.css +++ b/web/annotation_editor_layer_builder.css @@ -508,6 +508,8 @@ width: 100%; height: 100%; margin: 0; + top: 0; + left: 0; } } diff --git a/web/app.js b/web/app.js index c15aa2b02..a2b272a5a 100644 --- a/web/app.js +++ b/web/app.js @@ -372,6 +372,12 @@ const PDFViewerApplication = { params.get("supportscaretbrowsingmode") === "true" ); } + if (params.has("spreadmodeonload")) { + AppOptions.set( + "spreadModeOnLoad", + parseInt(params.get("spreadmodeonload")) + ); + } } },