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:
commit
45762c2f0e
3 changed files with 52 additions and 0 deletions
|
@ -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();
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -508,6 +508,8 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -372,6 +372,12 @@ const PDFViewerApplication = {
|
|||
params.get("supportscaretbrowsingmode") === "true"
|
||||
);
|
||||
}
|
||||
if (params.has("spreadmodeonload")) {
|
||||
AppOptions.set(
|
||||
"spreadModeOnLoad",
|
||||
parseInt(params.get("spreadmodeonload"))
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue