1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #17809 from calixteman/rotate_editor_layer

Don't hide the editor layer when rotating (follow-up of #17802)
This commit is contained in:
calixteman 2024-03-19 20:56:09 +01:00 committed by GitHub
commit 3718d0a9b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 1 deletions

View file

@ -129,6 +129,12 @@ class AnnotationEditorLayer {
return this.#editors.size === 0;
}
get isInvisible() {
return (
this.isEmpty && this.#uiManager.getMode() === AnnotationEditorType.NONE
);
}
/**
* Update the toolbar if it's required to reflect the tool currently used.
* @param {number} mode

View file

@ -3397,4 +3397,38 @@ describe("FreeText Editor", () => {
);
});
});
describe("Annotation editor layer visibility", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
});
afterAll(async () => {
await closePages(pages);
});
it("must check that the annotation layer is visible after a rotation", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await switchToFreeText(page);
for (let i = 0; i < 4; i++) {
await page.waitForSelector(
".page[data-page-number='1'] .annotationEditorLayer:not([hidden])",
{
timeout: 0,
}
);
const promise = await waitForAnnotationEditorLayer(page);
await page.evaluate(() => {
document.getElementById("pageRotateCw").click();
});
await awaitPromise(promise);
}
})
);
});
});
});

View file

@ -138,7 +138,7 @@ class AnnotationEditorLayerBuilder {
}
show() {
if (!this.div || this.annotationEditorLayer.isEmpty) {
if (!this.div || this.annotationEditorLayer.isInvisible) {
return;
}
this.div.hidden = false;