mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Remove mozCurrentTransform
/mozCurrentTransformInverse
usage
These canvas-context properties are Mozilla-specific, and has obviously never been implemented anywhere else. Currently they are in the process of being removed, see [bug 1782651](https://bugzilla.mozilla.org/show_bug.cgi?id=1782651) and [bug 1294360](https://bugzilla.mozilla.org/show_bug.cgi?id=1294360), which in practice means that in e.g. Firefox Nightly the `addContextCurrentTransform`-function is now being used in the *built-in* PDF Viewer (which was obviously never intended). We should thus be able to replace these Mozilla-specific properties with `CanvasRenderingContext2D.getTransform()`, which is available in all browsers that we currently support: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getTransform#browser_compatibility
This commit is contained in:
parent
0ebd1daf30
commit
358a0607fe
3 changed files with 69 additions and 235 deletions
|
@ -641,6 +641,16 @@ function binarySearchFirstItem(items, condition, start = 0) {
|
|||
return minIndex; /* === maxIndex */
|
||||
}
|
||||
|
||||
function getCurrentTransform(ctx) {
|
||||
const { a, b, c, d, e, f } = ctx.getTransform();
|
||||
return [a, b, c, d, e, f];
|
||||
}
|
||||
|
||||
function getCurrentTransformInverse(ctx) {
|
||||
const { a, b, c, d, e, f } = ctx.getTransform().invertSelf();
|
||||
return [a, b, c, d, e, f];
|
||||
}
|
||||
|
||||
export {
|
||||
binarySearchFirstItem,
|
||||
deprecated,
|
||||
|
@ -649,6 +659,8 @@ export {
|
|||
DOMStandardFontDataFactory,
|
||||
DOMSVGFactory,
|
||||
getColorValues,
|
||||
getCurrentTransform,
|
||||
getCurrentTransformInverse,
|
||||
getFilenameFromUrl,
|
||||
getPdfFilenameFromUrl,
|
||||
getRGB,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue