Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hide the editor layer when rotating (follow-up of #17802) #17809

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/display/editor/annotation_editor_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions test/integration/freetext_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
})
);
});
});
});
2 changes: 1 addition & 1 deletion web/annotation_editor_layer_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class AnnotationEditorLayerBuilder {
}

show() {
if (!this.div || this.annotationEditorLayer.isEmpty) {
if (!this.div || this.annotationEditorLayer.isInvisible) {
return;
}
this.div.hidden = false;
Expand Down