1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

[Editor] Fix the resizing of an editor when it's rotated (bug 1847268)

There are 2 rotation we've to deal with: the viewer one and the editor one.
The previous implementation was a bit complex and having to deal with these
rotation would have potentially increase it.
So this patch aims to simplify the implementation and deal with all the possible
cases.
The main idea is to transform the mouse deltas according to the rotations and then
apply the resizing in the page coordinates system.
This commit is contained in:
Calixte Denizet 2023-08-04 18:21:27 +02:00
parent 19c712c2d0
commit aa71619c2d
8 changed files with 448 additions and 313 deletions

View file

@ -202,3 +202,15 @@ async function dragAndDropAnnotation(page, startX, startY, tX, tY) {
await page.mouse.up();
}
exports.dragAndDropAnnotation = dragAndDropAnnotation;
async function waitForAnnotationEditorLayer(page) {
return page.evaluate(() => {
return new Promise(resolve => {
window.PDFViewerApplication.eventBus.on(
"annotationeditorlayerrendered",
resolve
);
});
});
}
exports.waitForAnnotationEditorLayer = waitForAnnotationEditorLayer;