mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-07 07:35:46 +02:00
Merge pull request #20883 from Snuffleupagus/PatternInfo-pointBoundingBox
Use the `Util.pointBoundingBox` helper in the `PatternInfo` class (PR 20340 follow-up)
This commit is contained in:
commit
1b88960ead
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert, FeatureTest, MeshFigureType } from "../shared/util.js";
|
import { assert, FeatureTest, MeshFigureType, Util } from "../shared/util.js";
|
||||||
import {
|
import {
|
||||||
CSS_FONT_INFO,
|
CSS_FONT_INFO,
|
||||||
FONT_INFO,
|
FONT_INFO,
|
||||||
@ -438,19 +438,11 @@ class PatternInfo {
|
|||||||
const shadingType = this.data[PATTERN_INFO.SHADING_TYPE];
|
const shadingType = this.data[PATTERN_INFO.SHADING_TYPE];
|
||||||
let bounds = null;
|
let bounds = null;
|
||||||
if (coords.length > 0) {
|
if (coords.length > 0) {
|
||||||
let minX = coords[0],
|
bounds = [Infinity, Infinity, -Infinity, -Infinity];
|
||||||
maxX = coords[0];
|
|
||||||
let minY = coords[1],
|
for (let i = 0, ii = coords.length; i < ii; i += 2) {
|
||||||
maxY = coords[1];
|
Util.pointBoundingBox(coords[i], coords[i + 1], bounds);
|
||||||
for (let i = 0; i < coords.length; i += 2) {
|
|
||||||
const x = coords[i],
|
|
||||||
y = coords[i + 1];
|
|
||||||
minX = minX > x ? x : minX;
|
|
||||||
minY = minY > y ? y : minY;
|
|
||||||
maxX = maxX < x ? x : maxX;
|
|
||||||
maxY = maxY < y ? y : maxY;
|
|
||||||
}
|
}
|
||||||
bounds = [minX, minY, maxX, maxY];
|
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
"Mesh",
|
"Mesh",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user