@@ -2952,6 +2952,9 @@ def __init__(self, ax, onselect, drawtype='box',
2952
2952
# so the selector is defined in display coordinates, which makes
2953
2953
# it much easier to handle rotation and scaling
2954
2954
to_draw .set_transform (None )
2955
+ # Becasue the transform in display coords, need to manually
2956
+ # add a resize callback for when the axes are reszied
2957
+ self .ax .figure .canvas .mpl_connect ('resize_event' , self ._on_resize )
2955
2958
2956
2959
if drawtype == 'line' :
2957
2960
_api .warn_deprecated (
@@ -3018,6 +3021,10 @@ def __init__(self, ax, onselect, drawtype='box',
3018
3021
property (lambda self : self .grab_range ,
3019
3022
lambda self , value : setattr (self , "grab_range" , value )))
3020
3023
3024
+ def _on_resize (self , event ):
3025
+ # Callback for an Axes resize
3026
+ self ._update_handles ()
3027
+
3021
3028
@property
3022
3029
def _position_state (self ):
3023
3030
"""Return a named tuple containing all position state attributes."""
@@ -3437,13 +3444,15 @@ def _update_selection_artist(self):
3437
3444
self ._selection_artist .set_data ([xy0 [0 ], xy1 [0 ]], [xy0 [1 ], xy1 [1 ]])
3438
3445
3439
3446
if self ._interactive :
3440
- # Update displayed handles
3441
- self ._corner_handles .set_data (* self .corners )
3442
- self ._edge_handles .set_data (* self .edge_centers )
3443
- self ._center_handle .set_data (* self .center )
3447
+ self ._update_handles ()
3444
3448
3445
3449
self .update ()
3446
3450
3451
+ def _update_handles (self ):
3452
+ self ._corner_handles .set_data (* self .corners )
3453
+ self ._edge_handles .set_data (* self .edge_centers )
3454
+ self ._center_handle .set_data (* self .center )
3455
+
3447
3456
def _set_active_handle (self , event ):
3448
3457
"""Set active handle based on the location of the mouse event."""
3449
3458
# Note: event.xdata/ydata in data coordinates, event.x/y in pixels
0 commit comments