File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -361,16 +361,17 @@ def get_tightbbox(self, renderer=None):
361
361
362
362
Returns
363
363
-------
364
- `.Bbox`
364
+ `.Bbox` or None
365
365
The enclosing bounding box (in figure pixel coordinates).
366
+ Returns None if clipping results in no intersection.
366
367
"""
367
368
bbox = self .get_window_extent (renderer )
368
369
if self .get_clip_on ():
369
370
clip_box = self .get_clip_box ()
370
371
if clip_box is not None :
371
372
bbox = Bbox .intersection (bbox , clip_box )
372
373
clip_path = self .get_clip_path ()
373
- if clip_path is not None :
374
+ if clip_path is not None and bbox is not None :
374
375
clip_path = clip_path .get_fully_transformed_path ()
375
376
bbox = Bbox .intersection (bbox , clip_path .get_extents ())
376
377
return bbox
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class BboxBase(TransformNode):
105
105
@staticmethod
106
106
def union (bboxes : Sequence [BboxBase ]) -> Bbox : ...
107
107
@staticmethod
108
- def intersection (bbox1 : BboxBase , bbox2 : BboxBase ) -> Bbox : ...
108
+ def intersection (bbox1 : BboxBase , bbox2 : BboxBase ) -> Bbox | None : ...
109
109
110
110
class Bbox (BboxBase ):
111
111
def __init__ (self , points : ArrayLike , ** kwargs ) -> None : ...
You can’t perform that action at this time.
0 commit comments