@@ -3137,11 +3137,19 @@ class PolygonSelector(_SelectorWidget):
31373137 ``dict(color='k', linestyle='-', linewidth=2, alpha=0.5)``.
31383138 Artist properties for the line representing the edges of the polygon.
31393139 markerprops : dict, default: \
3140+ ``dict(marker='o', markersize=7, mec='k', mfc='k', alpha=0.5)``.
3141+ Artist properties for the markers drawn at the vertices of the polygon.
3142+ Deprecated, use *handle_props* instead.
3143+ handle_props : dict, default: \
31403144 ``dict(marker='o', markersize=7, mec='k', mfc='k', alpha=0.5)``.
31413145 Artist properties for the markers drawn at the vertices of the polygon.
31423146 vertex_select_radius : float, default: 15px
31433147 A vertex is selected (to complete the polygon or to move a vertex) if
31443148 the mouse click is within *vertex_select_radius* pixels of the vertex.
3149+ Deprecated, use *handle_grab_distance* instead.
3150+ handle_grab_distance : float, default: 15px
3151+ A vertex is selected (to complete the polygon or to move a vertex) if
3152+ the mouse click is within *handle_grab_distance* pixels of the vertex.
31453153
31463154 Examples
31473155 --------
@@ -3154,8 +3162,11 @@ class PolygonSelector(_SelectorWidget):
31543162 point.
31553163 """
31563164
3165+ @_api .rename_parameter ("3.5" , "markerprops" , "handle_props" )
3166+ @_api .rename_parameter ("3.5" , "vertex_select_radius" ,
3167+ "handle_grab_distance" )
31573168 def __init__ (self , ax , onselect , useblit = False ,
3158- lineprops = None , markerprops = None , vertex_select_radius = 15 ):
3169+ lineprops = None , handle_props = None , handle_grab_distance = 15 ):
31593170 # The state modifiers 'move', 'square', and 'center' are expected by
31603171 # _SelectorWidget but are not supported by PolygonSelector
31613172 # Note: could not use the existing 'move' state modifier in-place of
@@ -3177,15 +3188,15 @@ def __init__(self, ax, onselect, useblit=False,
31773188 self .line = Line2D (self ._xs , self ._ys , ** lineprops )
31783189 self .ax .add_line (self .line )
31793190
3180- if markerprops is None :
3181- markerprops = dict (markeredgecolor = 'k' ,
3182- markerfacecolor = lineprops .get ('color' , 'k' ))
3191+ if handle_props is None :
3192+ handle_props = dict (markeredgecolor = 'k' ,
3193+ markerfacecolor = lineprops .get ('color' , 'k' ))
31833194 self ._polygon_handles = ToolHandles (self .ax , self ._xs , self ._ys ,
31843195 useblit = self .useblit ,
3185- marker_props = markerprops )
3196+ marker_props = handle_props )
31863197
31873198 self ._active_handle_idx = - 1
3188- self .vertex_select_radius = vertex_select_radius
3199+ self .handle_grab_distance = handle_grab_distance
31893200
31903201 self .artists = [self .line , self ._polygon_handles .artist ]
31913202 self .set_visible (True )
@@ -3223,7 +3234,7 @@ def _press(self, event):
32233234 if ((self ._polygon_completed or 'move_vertex' in self ._state )
32243235 and len (self ._xs ) > 0 ):
32253236 h_idx , h_dist = self ._polygon_handles .closest (event .x , event .y )
3226- if h_dist < self .vertex_select_radius :
3237+ if h_dist < self .handle_grab_distance :
32273238 self ._active_handle_idx = h_idx
32283239 # Save the vertex positions at the time of the press event (needed to
32293240 # support the 'move_all' state modifier).
@@ -3297,7 +3308,7 @@ def _onmove(self, event):
32973308 self ._ys [0 ]))
32983309 v0_dist = np .hypot (x0 - event .x , y0 - event .y )
32993310 # Lock on to the start vertex if near it and ready to complete.
3300- if len (self ._xs ) > 3 and v0_dist < self .vertex_select_radius :
3311+ if len (self ._xs ) > 3 and v0_dist < self .handle_grab_distance :
33013312 self ._xs [- 1 ], self ._ys [- 1 ] = self ._xs [0 ], self ._ys [0 ]
33023313 else :
33033314 self ._xs [- 1 ], self ._ys [- 1 ] = event .xdata , event .ydata
0 commit comments