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:
Tim van der Meij 2026-03-15 19:46:58 +01:00 committed by GitHub
commit 1b88960ead
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { assert, FeatureTest, MeshFigureType } from "../shared/util.js";
import { assert, FeatureTest, MeshFigureType, Util } from "../shared/util.js";
import {
CSS_FONT_INFO,
FONT_INFO,
@ -438,19 +438,11 @@ class PatternInfo {
const shadingType = this.data[PATTERN_INFO.SHADING_TYPE];
let bounds = null;
if (coords.length > 0) {
let minX = coords[0],
maxX = coords[0];
let minY = coords[1],
maxY = coords[1];
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 = [Infinity, Infinity, -Infinity, -Infinity];
for (let i = 0, ii = coords.length; i < ii; i += 2) {
Util.pointBoundingBox(coords[i], coords[i + 1], bounds);
}
bounds = [minX, minY, maxX, maxY];
}
return [
"Mesh",