[Editor] Scale the signature editor when it's too large (bug 1948741)
This commit is contained in:
parent
affce70a09
commit
3fc6b1321f
@ -248,6 +248,11 @@ class SignatureEditor extends DrawingEditor {
|
|||||||
newHeight = newHeight >= 1 ? 0.5 : newHeight;
|
newHeight = newHeight >= 1 ? 0.5 : newHeight;
|
||||||
|
|
||||||
this.width *= newHeight / this.height;
|
this.width *= newHeight / this.height;
|
||||||
|
if (this.width >= 1) {
|
||||||
|
newHeight *= 0.9 / this.width;
|
||||||
|
this.width = 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
this.height = newHeight;
|
this.height = newHeight;
|
||||||
this.setDims(parentWidth * this.width, parentHeight * this.height);
|
this.setDims(parentWidth * this.width, parentHeight * this.height);
|
||||||
this.x = savedX;
|
this.x = savedX;
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
import {
|
import {
|
||||||
closePages,
|
closePages,
|
||||||
getEditorSelector,
|
getEditorSelector,
|
||||||
|
getRect,
|
||||||
loadAndWait,
|
loadAndWait,
|
||||||
switchToEditor,
|
switchToEditor,
|
||||||
waitForTimeout,
|
waitForTimeout,
|
||||||
@ -207,4 +208,46 @@ describe("Signature Editor", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Bug 1948741", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must check that the editor isn't too large", async () => {
|
||||||
|
await Promise.all(
|
||||||
|
pages.map(async ([_, page]) => {
|
||||||
|
await switchToSignature(page);
|
||||||
|
await page.click("#editorSignatureAddSignature");
|
||||||
|
|
||||||
|
await page.waitForSelector("#addSignatureDialog", {
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
await page.type(
|
||||||
|
"#addSignatureTypeInput",
|
||||||
|
"[18:50:03] asset pdf.scripting.mjs 105 KiB [emitted] [javascript module] (name: main)"
|
||||||
|
);
|
||||||
|
await page.waitForSelector(`${addButtonSelector}:not(:disabled)`);
|
||||||
|
await page.click("#addSignatureAddButton");
|
||||||
|
|
||||||
|
const editorSelector = getEditorSelector(0);
|
||||||
|
await page.waitForSelector(editorSelector, { visible: true });
|
||||||
|
await page.waitForSelector(
|
||||||
|
`.canvasWrapper > svg use[href="#path_p1_0"]`,
|
||||||
|
{ visible: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
const { width } = await getRect(page, editorSelector);
|
||||||
|
const { width: pageWidth } = await getRect(page, ".page");
|
||||||
|
expect(width).toBeLessThanOrEqual(pageWidth);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user