mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
fix: don't scroll when drawing [#17327]
This commit is contained in:
parent
45a32b7c58
commit
78f612ffef
2 changed files with 53 additions and 1 deletions
|
@ -1084,4 +1084,54 @@ describe("Ink Editor", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Page position should remain unchanged after drawing", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that the page position remains the same after drawing", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
const pageInitialPosition = await getRect(
|
||||
page,
|
||||
".page[data-page-number='1']"
|
||||
);
|
||||
|
||||
await switchToInk(page);
|
||||
|
||||
const editorLayerRect = await getRect(page, ".annotationEditorLayer");
|
||||
const drawStartX = editorLayerRect.x + 100;
|
||||
const drawStartY = editorLayerRect.y + 100;
|
||||
|
||||
const clickHandle = await waitForPointerUp(page);
|
||||
await page.mouse.move(drawStartX, drawStartY);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(drawStartX + 50, drawStartY + 50);
|
||||
await page.mouse.up();
|
||||
await awaitPromise(clickHandle);
|
||||
await commit(page);
|
||||
|
||||
const pageFinalPosition = await getRect(
|
||||
page,
|
||||
".page[data-page-number='1']"
|
||||
);
|
||||
|
||||
expect(pageInitialPosition.x)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(pageFinalPosition.x);
|
||||
|
||||
expect(pageInitialPosition.y)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(pageFinalPosition.y);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue