Edit book: When dragging to select a region or adjust the selection fix mouse moving outside the image causing the region to no longer be adjusted

This commit is contained in:
Kovid Goyal 2022-03-13 06:54:36 +05:30
parent f1002b15ef
commit 8d8ee82288
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -531,8 +531,6 @@ class Canvas(QWidget):
pos = ev.pos() pos = ev.pos()
cursor = Qt.CursorShape.ArrowCursor cursor = Qt.CursorShape.ArrowCursor
try: try:
if not self.target.contains(pos):
return
if ev.buttons() & Qt.MouseButton.LeftButton: 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.last_press_point is not None and self.selection_state.current_mode is not None:
if self.selection_state.current_mode == 'select': if self.selection_state.current_mode == 'select':
@ -547,7 +545,7 @@ class Canvas(QWidget):
cursor = self.get_cursor() cursor = self.get_cursor()
changed = True changed = True
else: else:
if self.selection_state.rect is None or not self.selection_state.rect.contains(pos): if not self.target.contains(pos) or self.selection_state.rect is None or not self.selection_state.rect.contains(pos):
return return
if self.selection_state.current_mode == 'selected': if self.selection_state.current_mode == 'selected':
if self.selection_state.rect is not None and self.selection_state.rect.contains(pos): if self.selection_state.rect is not None and self.selection_state.rect.contains(pos):