mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
[Editor] Set the canvas in the stamp editor at the right position in odd spread mode
This commit is contained in:
parent
4c041586fb
commit
acf8600a3d
3 changed files with 52 additions and 0 deletions
|
@ -751,4 +751,48 @@ describe("Stamp Editor", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Add a stamp in odd spread mode", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
pages = await loadAndWait(
|
||||||
|
"empty.pdf",
|
||||||
|
".annotationEditorLayer",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
spreadModeOnLoad: 1,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must check that the stamp has its canvas at the right position", async () => {
|
||||||
|
await Promise.all(
|
||||||
|
pages.map(async ([browserName, page]) => {
|
||||||
|
await switchToStamp(page);
|
||||||
|
|
||||||
|
await copyImage(page, "../images/firefox_logo.png", 0);
|
||||||
|
await page.waitForSelector(getEditorSelector(0));
|
||||||
|
await waitForSerialized(page, 1);
|
||||||
|
|
||||||
|
const canvasRect = await getRect(
|
||||||
|
page,
|
||||||
|
`${getEditorSelector(0)} canvas`
|
||||||
|
);
|
||||||
|
const stampRect = await getRect(page, getEditorSelector(0));
|
||||||
|
|
||||||
|
expect(
|
||||||
|
["x", "y", "width", "height"].every(
|
||||||
|
key => Math.abs(canvasRect[key] - stampRect[key]) <= 10
|
||||||
|
)
|
||||||
|
).toBeTrue();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -508,6 +508,8 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -372,6 +372,12 @@ const PDFViewerApplication = {
|
||||||
params.get("supportscaretbrowsingmode") === "true"
|
params.get("supportscaretbrowsingmode") === "true"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (params.has("spreadmodeonload")) {
|
||||||
|
AppOptions.set(
|
||||||
|
"spreadModeOnLoad",
|
||||||
|
parseInt(params.get("spreadmodeonload"))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue