Merge pull request #19338 from avdoseferovic/fix/ink-editor-jumping
[Editor] Don't scroll when drawing (issue 17327)
This commit is contained in:
commit
f798bade4e
@ -805,7 +805,9 @@ class AnnotationEditorLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startDrawingSession(event) {
|
startDrawingSession(event) {
|
||||||
this.div.focus();
|
this.div.focus({
|
||||||
|
preventScroll: true,
|
||||||
|
});
|
||||||
if (this.#drawingAC) {
|
if (this.#drawingAC) {
|
||||||
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -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);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user