Skip to content

Commit fa8b70f

Browse files
committed
refactor: check visibility of main GUI earlier
1 parent 0910624 commit fa8b70f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

ORStools/utils/maptools.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,22 @@ def canvasReleaseEvent(self, event: QEvent) -> None:
220220
self.api_key_message_bar()
221221
else:
222222
raise e
223-
# Not moving release
223+
# Non-dragging release
224224
else:
225+
# Dragging is possible while the main GUI is visible.
226+
# Thus, we only check its visibility while not dragging
227+
if self.dlg.isVisible():
228+
return
229+
225230
try:
226-
if not self.dlg.isVisible():
227-
self.idx -= self.error_idxs
228-
self.dlg.create_vertex(point, self.idx)
229-
self.idx += 1
230-
self.error_idxs = 0
231+
self.idx -= self.error_idxs
232+
self.dlg.create_vertex(point, self.idx)
233+
self.idx += 1
234+
self.error_idxs = 0
231235

232-
if self.dlg.routing_fromline_list.count() > 1:
233-
self.create_rubber_band()
234-
self.dragging_vertex = False
236+
if self.dlg.routing_fromline_list.count() > 1:
237+
self.create_rubber_band()
238+
self.dragging_vertex = False
235239
except ApiError as e:
236240
if self.get_error_code(e) == 2010:
237241
self.error_idxs += 1

0 commit comments

Comments
 (0)