mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-24 00:45:49 +02:00
[api-minor] Remove the unused convertToViewportRectangle method in the PageViewport class
This method has been completely unused for many years, possibly as far back as PR 8030, hence we can avoid shipping a little bit of dead code. *Note:* If there's any third-party code depending on it, updating it ought to be as simple as changing ```javascript const r = viewport.convertToViewportRectangle(rect); ``` into ```javascript const r = [ ...viewport.convertToViewportPoint(rect[0], rect[1]), ...viewport.convertToViewportPoint(rect[2], rect[3]) ]; ```
This commit is contained in:
parent
ce08a803c4
commit
a543d0a2e0
@ -190,7 +190,6 @@ class PageViewport {
|
|||||||
* @returns {Array} Array containing `x`- and `y`-coordinates of the
|
* @returns {Array} Array containing `x`- and `y`-coordinates of the
|
||||||
* point in the viewport coordinate space.
|
* point in the viewport coordinate space.
|
||||||
* @see {@link convertToPdfPoint}
|
* @see {@link convertToPdfPoint}
|
||||||
* @see {@link convertToViewportRectangle}
|
|
||||||
*/
|
*/
|
||||||
convertToViewportPoint(x, y) {
|
convertToViewportPoint(x, y) {
|
||||||
const p = [x, y];
|
const p = [x, y];
|
||||||
@ -198,21 +197,6 @@ class PageViewport {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts PDF rectangle to the viewport coordinates.
|
|
||||||
* @param {Array} rect - The xMin, yMin, xMax and yMax coordinates.
|
|
||||||
* @returns {Array} Array containing corresponding coordinates of the
|
|
||||||
* rectangle in the viewport coordinate space.
|
|
||||||
* @see {@link convertToViewportPoint}
|
|
||||||
*/
|
|
||||||
convertToViewportRectangle(rect) {
|
|
||||||
const topLeft = [rect[0], rect[1]];
|
|
||||||
Util.applyTransform(topLeft, this.transform);
|
|
||||||
const bottomRight = [rect[2], rect[3]];
|
|
||||||
Util.applyTransform(bottomRight, this.transform);
|
|
||||||
return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts viewport coordinates to the PDF location. For examples, useful
|
* Converts viewport coordinates to the PDF location. For examples, useful
|
||||||
* for converting canvas pixel location into PDF one.
|
* for converting canvas pixel location into PDF one.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user