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):
361361
362362 Returns
363363 -------
364- `.Bbox`
364+ `.Bbox` or None
365365 The enclosing bounding box (in figure pixel coordinates).
366+ Returns None if clipping results in no intersection.
366367 """
367368 bbox = self .get_window_extent (renderer )
368369 if self .get_clip_on ():
369370 clip_box = self .get_clip_box ()
370371 if clip_box is not None :
371372 bbox = Bbox .intersection (bbox , clip_box )
372373 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 :
374375 clip_path = clip_path .get_fully_transformed_path ()
375376 bbox = Bbox .intersection (bbox , clip_path .get_extents ())
376377 return bbox
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class BboxBase(TransformNode):
105105 @staticmethod
106106 def union (bboxes : Sequence [BboxBase ]) -> Bbox : ...
107107 @staticmethod
108- def intersection (bbox1 : BboxBase , bbox2 : BboxBase ) -> Bbox : ...
108+ def intersection (bbox1 : BboxBase , bbox2 : BboxBase ) -> Bbox | None : ...
109109
110110class Bbox (BboxBase ):
111111 def __init__ (self , points : ArrayLike , ** kwargs ) -> None : ...
You can’t perform that action at this time.
0 commit comments