@@ -3150,7 +3150,7 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
31503150 """
31513151
31523152
3153- class _RectangleSelectorState (enum .Enum ):
3153+ class _RectangleSelectorAction (enum .Enum ):
31543154 ROTATE = enum .auto ()
31553155 MOVE = enum .auto ()
31563156 RESIZE = enum .auto ()
@@ -3291,15 +3291,15 @@ def _press(self, event):
32913291 self ._set_aspect_ratio_correction ()
32923292
32933293 match self ._get_action ():
3294- case _RectangleSelectorState .ROTATE :
3294+ case _RectangleSelectorAction .ROTATE :
32953295 # TODO: set to a rotate cursor if possible?
32963296 pass
3297- case _RectangleSelectorState .MOVE :
3297+ case _RectangleSelectorAction .MOVE :
32983298 self ._set_cursor (backend_tools .cursors .MOVE )
3299- case _RectangleSelectorState .RESIZE :
3299+ case _RectangleSelectorAction .RESIZE :
33003300 # TODO: set to a resize cursor if possible?
33013301 pass
3302- case _RectangleSelectorState .CREATE :
3302+ case _RectangleSelectorAction .CREATE :
33033303 self ._set_cursor (backend_tools .cursors .SELECT_REGION )
33043304
33053305 return False
@@ -3355,13 +3355,13 @@ def _release(self, event):
33553355 def _get_action (self ):
33563356 state = self ._state
33573357 if 'rotate' in state and self ._active_handle in self ._corner_order :
3358- return _RectangleSelectorState .ROTATE
3358+ return _RectangleSelectorAction .ROTATE
33593359 elif self ._active_handle == 'C' :
3360- return _RectangleSelectorState .MOVE
3360+ return _RectangleSelectorAction .MOVE
33613361 elif self ._active_handle :
3362- return _RectangleSelectorState .RESIZE
3362+ return _RectangleSelectorAction .RESIZE
33633363
3364- return _RectangleSelectorState .CREATE
3364+ return _RectangleSelectorAction .CREATE
33653365
33663366
33673367 def _onmove (self , event ):
@@ -3381,7 +3381,7 @@ def _onmove(self, event):
33813381 action = self ._get_action ()
33823382
33833383 xdata , ydata = self ._get_data_coords (event )
3384- if action == _RectangleSelectorState .RESIZE :
3384+ if action == _RectangleSelectorAction .RESIZE :
33853385 inv_tr = self ._get_rotation_transform ().inverted ()
33863386 xdata , ydata = inv_tr .transform ([xdata , ydata ])
33873387 eventpress .xdata , eventpress .ydata = inv_tr .transform (
@@ -3401,7 +3401,7 @@ def _onmove(self, event):
34013401
34023402 x0 , x1 , y0 , y1 = self ._extents_on_press
34033403 # rotate an existing shape
3404- if action == _RectangleSelectorState .ROTATE :
3404+ if action == _RectangleSelectorAction .ROTATE :
34053405 # calculate angle abc
34063406 a = (eventpress .xdata , eventpress .ydata )
34073407 b = self .center
@@ -3410,7 +3410,7 @@ def _onmove(self, event):
34103410 np .arctan2 (a [1 ]- b [1 ], a [0 ]- b [0 ]))
34113411 self .rotation = np .rad2deg (self ._rotation_on_press + angle )
34123412
3413- elif action == _RectangleSelectorState .RESIZE :
3413+ elif action == _RectangleSelectorAction .RESIZE :
34143414 size_on_press = [x1 - x0 , y1 - y0 ]
34153415 center = (x0 + size_on_press [0 ] / 2 , y0 + size_on_press [1 ] / 2 )
34163416
@@ -3461,7 +3461,7 @@ def _onmove(self, event):
34613461 sign = np .sign (xdata - x0 )
34623462 x1 = x0 + sign * abs (y1 - y0 ) * self ._aspect_ratio_correction
34633463
3464- elif action == _RectangleSelectorState .MOVE :
3464+ elif action == _RectangleSelectorAction .MOVE :
34653465 x0 , x1 , y0 , y1 = self ._extents_on_press
34663466 dx = xdata - eventpress .xdata
34673467 dy = ydata - eventpress .ydata
0 commit comments