|
13 | 13 | * limitations under the License. |
14 | 14 | */ |
15 | 15 |
|
16 | | -import { FeatureTest, Util } from "../shared/util.js"; |
| 16 | +import { FeatureTest, MathClamp, Util } from "../shared/util.js"; |
17 | 17 |
|
18 | 18 | const FORCED_DEPENDENCY_LABEL = "__forcedDependency"; |
19 | 19 |
|
@@ -257,22 +257,11 @@ class CanvasBBoxTracker { |
257 | 257 |
|
258 | 258 | const bbox = [Infinity, Infinity, -Infinity, -Infinity]; |
259 | 259 | Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform, bbox); |
260 | | - this.#pendingBBox[0] = Math.min( |
261 | | - this.#pendingBBox[0], |
262 | | - Math.max(bbox[0], clipBox[0]) |
263 | | - ); |
264 | | - this.#pendingBBox[1] = Math.min( |
265 | | - this.#pendingBBox[1], |
266 | | - Math.max(bbox[1], clipBox[1]) |
267 | | - ); |
268 | | - this.#pendingBBox[2] = Math.max( |
269 | | - this.#pendingBBox[2], |
270 | | - Math.min(bbox[2], clipBox[2]) |
271 | | - ); |
272 | | - this.#pendingBBox[3] = Math.max( |
273 | | - this.#pendingBBox[3], |
274 | | - Math.min(bbox[3], clipBox[3]) |
275 | | - ); |
| 260 | + |
| 261 | + this.#pendingBBox[0] = MathClamp(bbox[0], clipBox[0], this.#pendingBBox[0]); |
| 262 | + this.#pendingBBox[1] = MathClamp(bbox[1], clipBox[1], this.#pendingBBox[1]); |
| 263 | + this.#pendingBBox[2] = MathClamp(bbox[2], this.#pendingBBox[2], clipBox[2]); |
| 264 | + this.#pendingBBox[3] = MathClamp(bbox[3], this.#pendingBBox[3], clipBox[3]); |
276 | 265 | return this; |
277 | 266 | } |
278 | 267 |
|
|
0 commit comments