@@ -3150,7 +3150,7 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
3150
3150
"""
3151
3151
3152
3152
3153
- class _RectangleSelectorState (enum .Enum ):
3153
+ class _RectangleSelectorAction (enum .Enum ):
3154
3154
ROTATE = enum .auto ()
3155
3155
MOVE = enum .auto ()
3156
3156
RESIZE = enum .auto ()
@@ -3291,15 +3291,15 @@ def _press(self, event):
3291
3291
self ._set_aspect_ratio_correction ()
3292
3292
3293
3293
match self ._get_action ():
3294
- case _RectangleSelectorState .ROTATE :
3294
+ case _RectangleSelectorAction .ROTATE :
3295
3295
# TODO: set to a rotate cursor if possible?
3296
3296
pass
3297
- case _RectangleSelectorState .MOVE :
3297
+ case _RectangleSelectorAction .MOVE :
3298
3298
self ._set_cursor (backend_tools .cursors .MOVE )
3299
- case _RectangleSelectorState .RESIZE :
3299
+ case _RectangleSelectorAction .RESIZE :
3300
3300
# TODO: set to a resize cursor if possible?
3301
3301
pass
3302
- case _RectangleSelectorState .CREATE :
3302
+ case _RectangleSelectorAction .CREATE :
3303
3303
self ._set_cursor (backend_tools .cursors .SELECT_REGION )
3304
3304
3305
3305
return False
@@ -3355,13 +3355,13 @@ def _release(self, event):
3355
3355
def _get_action (self ):
3356
3356
state = self ._state
3357
3357
if 'rotate' in state and self ._active_handle in self ._corner_order :
3358
- return _RectangleSelectorState .ROTATE
3358
+ return _RectangleSelectorAction .ROTATE
3359
3359
elif self ._active_handle == 'C' :
3360
- return _RectangleSelectorState .MOVE
3360
+ return _RectangleSelectorAction .MOVE
3361
3361
elif self ._active_handle :
3362
- return _RectangleSelectorState .RESIZE
3362
+ return _RectangleSelectorAction .RESIZE
3363
3363
3364
- return _RectangleSelectorState .CREATE
3364
+ return _RectangleSelectorAction .CREATE
3365
3365
3366
3366
3367
3367
def _onmove (self , event ):
@@ -3381,7 +3381,7 @@ def _onmove(self, event):
3381
3381
action = self ._get_action ()
3382
3382
3383
3383
xdata , ydata = self ._get_data_coords (event )
3384
- if action == _RectangleSelectorState .RESIZE :
3384
+ if action == _RectangleSelectorAction .RESIZE :
3385
3385
inv_tr = self ._get_rotation_transform ().inverted ()
3386
3386
xdata , ydata = inv_tr .transform ([xdata , ydata ])
3387
3387
eventpress .xdata , eventpress .ydata = inv_tr .transform (
@@ -3401,7 +3401,7 @@ def _onmove(self, event):
3401
3401
3402
3402
x0 , x1 , y0 , y1 = self ._extents_on_press
3403
3403
# rotate an existing shape
3404
- if action == _RectangleSelectorState .ROTATE :
3404
+ if action == _RectangleSelectorAction .ROTATE :
3405
3405
# calculate angle abc
3406
3406
a = (eventpress .xdata , eventpress .ydata )
3407
3407
b = self .center
@@ -3410,7 +3410,7 @@ def _onmove(self, event):
3410
3410
np .arctan2 (a [1 ]- b [1 ], a [0 ]- b [0 ]))
3411
3411
self .rotation = np .rad2deg (self ._rotation_on_press + angle )
3412
3412
3413
- elif action == _RectangleSelectorState .RESIZE :
3413
+ elif action == _RectangleSelectorAction .RESIZE :
3414
3414
size_on_press = [x1 - x0 , y1 - y0 ]
3415
3415
center = (x0 + size_on_press [0 ] / 2 , y0 + size_on_press [1 ] / 2 )
3416
3416
@@ -3461,7 +3461,7 @@ def _onmove(self, event):
3461
3461
sign = np .sign (xdata - x0 )
3462
3462
x1 = x0 + sign * abs (y1 - y0 ) * self ._aspect_ratio_correction
3463
3463
3464
- elif action == _RectangleSelectorState .MOVE :
3464
+ elif action == _RectangleSelectorAction .MOVE :
3465
3465
x0 , x1 , y0 , y1 = self ._extents_on_press
3466
3466
dx = xdata - eventpress .xdata
3467
3467
dy = ydata - eventpress .ydata
0 commit comments