Image editor: Down allow initial mouse drag to create selection rect outside the image bounds

This commit is contained in:
Kovid Goyal 2022-07-26 13:32:11 +05:30
parent 5d4fcb02df
commit 2cbf22a67b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -534,7 +534,9 @@ class Canvas(QWidget):
if ev.buttons() & Qt.MouseButton.LeftButton:
if self.selection_state.last_press_point is not None and self.selection_state.current_mode is not None:
if self.selection_state.current_mode == 'select':
self.selection_state.rect = QRectF(self.selection_state.last_press_point, pos).normalized()
r = QRectF(self.selection_state.last_press_point, pos).normalized()
r = r.intersected(self.target)
self.selection_state.rect = r
changed = True
elif self.selection_state.last_drag_pos is not None:
self.selection_state.in_selection = True