ntk 8.12.12 → 8.12.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/renderingcontext_2d.js +11 -1
- package/package.json +1 -1
|
@@ -3640,7 +3640,17 @@ class RenderingContext2d {
|
|
|
3640
3640
|
const y = Math.min(...ys);
|
|
3641
3641
|
const w = Math.max(...xs) - x;
|
|
3642
3642
|
const h = Math.max(...ys) - y;
|
|
3643
|
-
|
|
3643
|
+
// A rectangle of no area is still one, and clips everything: what a box
|
|
3644
|
+
// of no height clips its content to, a menu at `max-height: 0`. Taken
|
|
3645
|
+
// for a path, it built the mask the size of the surface, and every
|
|
3646
|
+
// rectangle clipped inside it was intersected into that mask; the
|
|
3647
|
+
// intersection of an empty one is empty, and every consumer draws
|
|
3648
|
+
// nothing through that, as where two rectangles do not meet.
|
|
3649
|
+
if (!(w > 0 && h > 0)) {
|
|
3650
|
+
return Number.isFinite(w) && Number.isFinite(h)
|
|
3651
|
+
? { x: 0, y: 0, w: 0, h: 0 }
|
|
3652
|
+
: null;
|
|
3653
|
+
}
|
|
3644
3654
|
// Server clip rectangles are integers, so a fractional edge could only
|
|
3645
3655
|
// be honoured by rounding — which would differ from the mask path's
|
|
3646
3656
|
// antialiased edge by up to a pixel. Rare, so leave those to the mask
|