@@ -1915,7 +1915,7 @@ def on_select(min: float, max: float) -> Any
1915
1915
when *interactive* is True. See `matplotlib.lines.Line2D` for valid
1916
1916
properties.
1917
1917
1918
- handle_grab_distance : float, default: 10
1918
+ grab_range : float, default: 10
1919
1919
Distance in pixels within which the interactive tool handles can be
1920
1920
activated.
1921
1921
@@ -1942,7 +1942,7 @@ def on_select(min: float, max: float) -> Any
1942
1942
@_api .rename_parameter ("3.5" , "span_stays" , "interactive" )
1943
1943
def __init__ (self , ax , onselect , direction , minspan = 0 , useblit = False ,
1944
1944
props = None , onmove_callback = None , interactive = False ,
1945
- button = None , handle_props = None , handle_grab_distance = 10 ,
1945
+ button = None , handle_props = None , grab_range = 10 ,
1946
1946
drag_from_anywhere = False ):
1947
1947
1948
1948
super ().__init__ (ax , onselect , useblit = useblit , button = button )
@@ -1966,7 +1966,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
1966
1966
self .onmove_callback = onmove_callback
1967
1967
self .minspan = minspan
1968
1968
1969
- self .handle_grab_distance = handle_grab_distance
1969
+ self .grab_range = grab_range
1970
1970
self ._interactive = interactive
1971
1971
self .drag_from_anywhere = drag_from_anywhere
1972
1972
@@ -2173,7 +2173,7 @@ def _set_active_handle(self, event):
2173
2173
# Use 'C' to match the notation used in the RectangleSelector
2174
2174
if 'move' in self .state :
2175
2175
self ._active_handle = 'C'
2176
- elif e_dist > self .handle_grab_distance :
2176
+ elif e_dist > self .grab_range :
2177
2177
# Not close to any handles
2178
2178
self ._active_handle = None
2179
2179
if self .drag_from_anywhere and self ._contains (event ):
@@ -2421,7 +2421,7 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
2421
2421
button : `.MouseButton`, list of `.MouseButton`, default: all buttons
2422
2422
Button(s) that trigger rectangle selection.
2423
2423
2424
- handle_grab_distance : float, default: 10
2424
+ grab_range : float, default: 10
2425
2425
Distance in pixels within which the interactive tool handles can be
2426
2426
activated.
2427
2427
@@ -2483,15 +2483,15 @@ class RectangleSelector(_SelectorWidget):
2483
2483
2484
2484
_shape_klass = Rectangle
2485
2485
2486
- @_api .rename_parameter ("3.5" , "maxdist" , "handle_grab_distance " )
2486
+ @_api .rename_parameter ("3.5" , "maxdist" , "grab_range " )
2487
2487
@_api .rename_parameter ("3.5" , "marker_props" , "handle_props" )
2488
2488
@_api .rename_parameter ("3.5" , "rectprops" , "props" )
2489
2489
@_api .delete_parameter ("3.5" , "drawtype" )
2490
2490
@_api .delete_parameter ("3.5" , "lineprops" )
2491
2491
def __init__ (self , ax , onselect , drawtype = 'box' ,
2492
2492
minspanx = 0 , minspany = 0 , useblit = False ,
2493
2493
lineprops = None , props = None , spancoords = 'data' ,
2494
- button = None , handle_grab_distance = 10 , handle_props = None ,
2494
+ button = None , grab_range = 10 , handle_props = None ,
2495
2495
interactive = False , state_modifier_keys = None ,
2496
2496
drag_from_anywhere = False ):
2497
2497
super ().__init__ (ax , onselect , useblit = useblit , button = button ,
@@ -2542,7 +2542,7 @@ def __init__(self, ax, onselect, drawtype='box',
2542
2542
self .spancoords = spancoords
2543
2543
self ._drawtype = drawtype
2544
2544
2545
- self .handle_grab_distance = handle_grab_distance
2545
+ self .grab_range = grab_range
2546
2546
2547
2547
if props is None :
2548
2548
_handle_props = dict (markeredgecolor = 'black' )
@@ -2589,7 +2589,7 @@ def __init__(self, ax, onselect, drawtype='box',
2589
2589
interactive = _api .deprecate_privatize_attribute ("3.5" )
2590
2590
2591
2591
maxdist = _api .deprecated ("3.5" )(
2592
- property (lambda self : self .handle_grab_distance )
2592
+ property (lambda self : self .grab_range )
2593
2593
)
2594
2594
2595
2595
def _press (self , event ):
@@ -2806,11 +2806,11 @@ def _set_active_handle(self, event):
2806
2806
self ._active_handle = 'C'
2807
2807
self ._extents_on_press = self .extents
2808
2808
# Set active handle as closest handle, if mouse click is close enough.
2809
- elif m_dist < self .handle_grab_distance * 2 :
2809
+ elif m_dist < self .grab_range * 2 :
2810
2810
# Prioritise center handle over other handles
2811
2811
self ._active_handle = 'C'
2812
- elif (c_dist > self .handle_grab_distance and
2813
- e_dist > self .handle_grab_distance ):
2812
+ elif (c_dist > self .grab_range and
2813
+ e_dist > self .grab_range ):
2814
2814
# Not close to any handles
2815
2815
if self .drag_from_anywhere and self ._contains (event ):
2816
2816
# Check if we've clicked inside the region
@@ -3058,9 +3058,9 @@ class PolygonSelector(_SelectorWidget):
3058
3058
the default value of ``markeredgecolor`` which will be the same as the
3059
3059
``color`` property in *props*.
3060
3060
3061
- handle_grab_distance : float, default: 15px
3061
+ grab_range : float, default: 10
3062
3062
A vertex is selected (to complete the polygon or to move a vertex) if
3063
- the mouse click is within *handle_grab_distance * pixels of the vertex.
3063
+ the mouse click is within *grab_range * pixels of the vertex.
3064
3064
3065
3065
Examples
3066
3066
--------
@@ -3075,10 +3075,9 @@ class PolygonSelector(_SelectorWidget):
3075
3075
3076
3076
@_api .rename_parameter ("3.5" , "lineprops" , "props" )
3077
3077
@_api .rename_parameter ("3.5" , "markerprops" , "handle_props" )
3078
- @_api .rename_parameter ("3.5" , "vertex_select_radius" ,
3079
- "handle_grab_distance" )
3078
+ @_api .rename_parameter ("3.5" , "vertex_select_radius" , "grab_range" )
3080
3079
def __init__ (self , ax , onselect , useblit = False ,
3081
- props = None , handle_props = None , handle_grab_distance = 15 ):
3080
+ props = None , handle_props = None , grab_range = 10 ):
3082
3081
# The state modifiers 'move', 'square', and 'center' are expected by
3083
3082
# _SelectorWidget but are not supported by PolygonSelector
3084
3083
# Note: could not use the existing 'move' state modifier in-place of
@@ -3108,13 +3107,13 @@ def __init__(self, ax, onselect, useblit=False,
3108
3107
marker_props = handle_props )
3109
3108
3110
3109
self ._active_handle_idx = - 1
3111
- self .handle_grab_distance = handle_grab_distance
3110
+ self .grab_range = grab_range
3112
3111
3113
3112
self .artists = [self .line , self ._polygon_handles .artist ]
3114
3113
self .set_visible (True )
3115
3114
3116
3115
vertex_select_radius = _api .deprecated ("3.5" )(
3117
- property (lambda self : self .handle_grab_distance )
3116
+ property (lambda self : self .grab_range )
3118
3117
)
3119
3118
3120
3119
@property
@@ -3150,7 +3149,7 @@ def _press(self, event):
3150
3149
if ((self ._polygon_completed or 'move_vertex' in self .state )
3151
3150
and len (self ._xs ) > 0 ):
3152
3151
h_idx , h_dist = self ._polygon_handles .closest (event .x , event .y )
3153
- if h_dist < self .handle_grab_distance :
3152
+ if h_dist < self .grab_range :
3154
3153
self ._active_handle_idx = h_idx
3155
3154
# Save the vertex positions at the time of the press event (needed to
3156
3155
# support the 'move_all' state modifier).
@@ -3224,7 +3223,7 @@ def _onmove(self, event):
3224
3223
self ._ys [0 ]))
3225
3224
v0_dist = np .hypot (x0 - event .x , y0 - event .y )
3226
3225
# Lock on to the start vertex if near it and ready to complete.
3227
- if len (self ._xs ) > 3 and v0_dist < self .handle_grab_distance :
3226
+ if len (self ._xs ) > 3 and v0_dist < self .grab_range :
3228
3227
self ._xs [- 1 ], self ._ys [- 1 ] = self ._xs [0 ], self ._ys [0 ]
3229
3228
else :
3230
3229
self ._xs [- 1 ], self ._ys [- 1 ] = event .xdata , event .ydata
0 commit comments