1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 15:48:06 +02:00

[api-minor] Support custom offsetX/offsetY values in PDFPageProxy.getViewport and PageViewport.clone

There's no good reason, as far as I can tell, to not also support `offsetX`/`offsetY` in addition to e.g. `dontFlip`.
This commit is contained in:
Jonas Jenwald 2019-10-23 20:35:49 +02:00
parent 2046adcc49
commit 681bc9d70e
3 changed files with 21 additions and 5 deletions

View file

@ -1100,6 +1100,11 @@ describe('api', function() {
expect(viewport.width).toEqual(1262.835);
expect(viewport.height).toEqual(892.92);
});
it('gets viewport with "offsetX/offsetY" arguments', function () {
const viewport = page.getViewport({ scale: 1, rotation: 0,
offsetX: 100, offsetY: -100, });
expect(viewport.transform).toEqual([1, 0, 0, -1, 100, 741.89]);
});
it('gets viewport respecting "dontFlip" argument', function () {
const scale = 1, rotation = 0;
let viewport = page.getViewport({ scale, rotation, });