1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 09:08:07 +02:00

Merge pull request #19338 from avdoseferovic/fix/ink-editor-jumping

[Editor] Don't scroll when drawing (issue 17327)
This commit is contained in:
calixteman 2025-01-23 22:07:29 +01:00 committed by GitHub
commit f798bade4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 53 additions and 1 deletions

View file

@ -1075,4 +1075,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);
})
);
});
});
});