@@ -2047,7 +2047,7 @@ def on_select(min: float, max: float) -> Any
20472047 when *interactive* is True. See `matplotlib.lines.Line2D` for valid
20482048 properties.
20492049
2050- handle_grab_distance : float, default: 10
2050+ grab_range : float, default: 10
20512051 Distance in pixels within which the interactive tool handles can be
20522052 activated.
20532053
@@ -2074,7 +2074,7 @@ def on_select(min: float, max: float) -> Any
20742074 @_api .rename_parameter ("3.5" , "span_stays" , "interactive" )
20752075 def __init__ (self , ax , onselect , direction , minspan = 0 , useblit = False ,
20762076 props = None , onmove_callback = None , interactive = False ,
2077- button = None , handle_props = None , handle_grab_distance = 10 ,
2077+ button = None , handle_props = None , grab_range = 10 ,
20782078 drag_from_anywhere = False ):
20792079
20802080 super ().__init__ (ax , onselect , useblit = useblit , button = button )
@@ -2098,7 +2098,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
20982098 self .onmove_callback = onmove_callback
20992099 self .minspan = minspan
21002100
2101- self .handle_grab_distance = handle_grab_distance
2101+ self .grab_range = grab_range
21022102 self ._interactive = interactive
21032103 self .drag_from_anywhere = drag_from_anywhere
21042104
@@ -2305,7 +2305,7 @@ def _set_active_handle(self, event):
23052305 # Use 'C' to match the notation used in the RectangleSelector
23062306 if 'move' in self ._state :
23072307 self ._active_handle = 'C'
2308- elif e_dist > self .handle_grab_distance :
2308+ elif e_dist > self .grab_range :
23092309 # Not close to any handles
23102310 self ._active_handle = None
23112311 if self .drag_from_anywhere and self ._contains (event ):
@@ -2553,7 +2553,7 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
25532553 button : `.MouseButton`, list of `.MouseButton`, default: all buttons
25542554 Button(s) that trigger rectangle selection.
25552555
2556- handle_grab_distance : float, default: 10
2556+ grab_range : float, default: 10
25572557 Distance in pixels within which the interactive tool handles can be
25582558 activated.
25592559
@@ -2615,15 +2615,15 @@ class RectangleSelector(_SelectorWidget):
26152615
26162616 _shape_klass = Rectangle
26172617
2618- @_api .rename_parameter ("3.5" , "maxdist" , "handle_grab_distance " )
2618+ @_api .rename_parameter ("3.5" , "maxdist" , "grab_range " )
26192619 @_api .rename_parameter ("3.5" , "marker_props" , "handle_props" )
26202620 @_api .rename_parameter ("3.5" , "rectprops" , "props" )
26212621 @_api .delete_parameter ("3.5" , "drawtype" )
26222622 @_api .delete_parameter ("3.5" , "lineprops" )
26232623 def __init__ (self , ax , onselect , drawtype = 'box' ,
26242624 minspanx = 0 , minspany = 0 , useblit = False ,
26252625 lineprops = None , props = None , spancoords = 'data' ,
2626- button = None , handle_grab_distance = 10 , handle_props = None ,
2626+ button = None , grab_range = 10 , handle_props = None ,
26272627 interactive = False , state_modifier_keys = None ,
26282628 drag_from_anywhere = False ):
26292629 super ().__init__ (ax , onselect , useblit = useblit , button = button ,
@@ -2674,7 +2674,7 @@ def __init__(self, ax, onselect, drawtype='box',
26742674 self .spancoords = spancoords
26752675 self ._drawtype = drawtype
26762676
2677- self .handle_grab_distance = handle_grab_distance
2677+ self .grab_range = grab_range
26782678
26792679 if props is None :
26802680 _handle_props = dict (markeredgecolor = 'black' )
@@ -2721,7 +2721,7 @@ def __init__(self, ax, onselect, drawtype='box',
27212721 interactive = _api .deprecate_privatize_attribute ("3.5" )
27222722
27232723 maxdist = _api .deprecated ("3.5" )(
2724- property (lambda self : self .handle_grab_distance )
2724+ property (lambda self : self .grab_range )
27252725 )
27262726
27272727 def _press (self , event ):
@@ -2938,11 +2938,11 @@ def _set_active_handle(self, event):
29382938 self ._active_handle = 'C'
29392939 self ._extents_on_press = self .extents
29402940 # Set active handle as closest handle, if mouse click is close enough.
2941- elif m_dist < self .handle_grab_distance * 2 :
2941+ elif m_dist < self .grab_range * 2 :
29422942 # Prioritise center handle over other handles
29432943 self ._active_handle = 'C'
2944- elif (c_dist > self .handle_grab_distance and
2945- e_dist > self .handle_grab_distance ):
2944+ elif (c_dist > self .grab_range and
2945+ e_dist > self .grab_range ):
29462946 # Not close to any handles
29472947 if self .drag_from_anywhere and self ._contains (event ):
29482948 # Check if we've clicked inside the region
@@ -3190,9 +3190,9 @@ class PolygonSelector(_SelectorWidget):
31903190 the default value of ``markeredgecolor`` which will be the same as the
31913191 ``color`` property in *props*.
31923192
3193- handle_grab_distance : float, default: 15px
3193+ grab_range : float, default: 10
31943194 A vertex is selected (to complete the polygon or to move a vertex) if
3195- the mouse click is within *handle_grab_distance * pixels of the vertex.
3195+ the mouse click is within *grab_range * pixels of the vertex.
31963196
31973197 Examples
31983198 --------
@@ -3207,10 +3207,9 @@ class PolygonSelector(_SelectorWidget):
32073207
32083208 @_api .rename_parameter ("3.5" , "lineprops" , "props" )
32093209 @_api .rename_parameter ("3.5" , "markerprops" , "handle_props" )
3210- @_api .rename_parameter ("3.5" , "vertex_select_radius" ,
3211- "handle_grab_distance" )
3210+ @_api .rename_parameter ("3.5" , "vertex_select_radius" , "grab_range" )
32123211 def __init__ (self , ax , onselect , useblit = False ,
3213- props = None , handle_props = None , handle_grab_distance = 15 ):
3212+ props = None , handle_props = None , grab_range = 10 ):
32143213 # The state modifiers 'move', 'square', and 'center' are expected by
32153214 # _SelectorWidget but are not supported by PolygonSelector
32163215 # Note: could not use the existing 'move' state modifier in-place of
@@ -3240,13 +3239,13 @@ def __init__(self, ax, onselect, useblit=False,
32403239 marker_props = handle_props )
32413240
32423241 self ._active_handle_idx = - 1
3243- self .handle_grab_distance = handle_grab_distance
3242+ self .grab_range = grab_range
32443243
32453244 self .artists = [self .line , self ._polygon_handles .artist ]
32463245 self .set_visible (True )
32473246
32483247 vertex_select_radius = _api .deprecated ("3.5" )(
3249- property (lambda self : self .handle_grab_distance )
3248+ property (lambda self : self .grab_range )
32503249 )
32513250
32523251 @property
@@ -3282,7 +3281,7 @@ def _press(self, event):
32823281 if ((self ._polygon_completed or 'move_vertex' in self ._state )
32833282 and len (self ._xs ) > 0 ):
32843283 h_idx , h_dist = self ._polygon_handles .closest (event .x , event .y )
3285- if h_dist < self .handle_grab_distance :
3284+ if h_dist < self .grab_range :
32863285 self ._active_handle_idx = h_idx
32873286 # Save the vertex positions at the time of the press event (needed to
32883287 # support the 'move_all' state modifier).
@@ -3356,7 +3355,7 @@ def _onmove(self, event):
33563355 self ._ys [0 ]))
33573356 v0_dist = np .hypot (x0 - event .x , y0 - event .y )
33583357 # Lock on to the start vertex if near it and ready to complete.
3359- if len (self ._xs ) > 3 and v0_dist < self .handle_grab_distance :
3358+ if len (self ._xs ) > 3 and v0_dist < self .grab_range :
33603359 self ._xs [- 1 ], self ._ys [- 1 ] = self ._xs [0 ], self ._ys [0 ]
33613360 else :
33623361 self ._xs [- 1 ], self ._ys [- 1 ] = event .xdata , event .ydata
0 commit comments