mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Don't hide the editor layer when rotating (follow-up of #17802)
Before the patch in #17802, the layer was made visible when calling updateMode after the rotation angle was set.
This commit is contained in:
parent
e892f3b18f
commit
a3873e4c68
3 changed files with 41 additions and 1 deletions
|
@ -129,6 +129,12 @@ class AnnotationEditorLayer {
|
||||||
return this.#editors.size === 0;
|
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.
|
* Update the toolbar if it's required to reflect the tool currently used.
|
||||||
* @param {number} mode
|
* @param {number} mode
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -138,7 +138,7 @@ class AnnotationEditorLayerBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
if (!this.div || this.annotationEditorLayer.isEmpty) {
|
if (!this.div || this.annotationEditorLayer.isInvisible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.div.hidden = false;
|
this.div.hidden = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue