Button press event handler.
(self, event)
| 3481 | rotation_point='center', **props) |
| 3482 | |
| 3483 | def _press(self, event): |
| 3484 | """Button press event handler.""" |
| 3485 | # make the drawn box/line visible get the click-coordinates, button, ... |
| 3486 | if self._interactive and self._selection_artist.get_visible(): |
| 3487 | self._set_active_handle(event) |
| 3488 | else: |
| 3489 | self._active_handle = None |
| 3490 | |
| 3491 | if ((self._active_handle is None or not self._interactive) and |
| 3492 | self._allow_creation): |
| 3493 | # Clear previous rectangle before drawing new rectangle. |
| 3494 | self.update() |
| 3495 | |
| 3496 | if (self._active_handle is None and not self.ignore_event_outside and |
| 3497 | self._allow_creation): |
| 3498 | self._visible = False |
| 3499 | self.extents = event.xdata, event.xdata, event.ydata, event.ydata |
| 3500 | self._visible = True |
| 3501 | else: |
| 3502 | self.set_visible(True) |
| 3503 | |
| 3504 | self._extents_on_press = self.extents |
| 3505 | self._rotation_on_press = self._rotation |
| 3506 | self._set_aspect_ratio_correction() |
| 3507 | |
| 3508 | match self._get_action(): |
| 3509 | case _RectangleSelectorAction.ROTATE: |
| 3510 | # TODO: set to a rotate cursor if possible? |
| 3511 | pass |
| 3512 | case _RectangleSelectorAction.MOVE: |
| 3513 | self._set_cursor(backend_tools.cursors.MOVE) |
| 3514 | case _RectangleSelectorAction.RESIZE: |
| 3515 | # TODO: set to a resize cursor if possible? |
| 3516 | pass |
| 3517 | case _RectangleSelectorAction.CREATE: |
| 3518 | self._set_cursor(backend_tools.cursors.SELECT_REGION) |
| 3519 | |
| 3520 | return False |
| 3521 | |
| 3522 | @_call_with_reparented_event |
| 3523 | def _release(self, event): |
nothing calls this directly
no test coverage detected