@@ -101,6 +101,9 @@ def deactivate(self):
101101
102102 mouseMoved = pyqtSignal (["QPoint" ])
103103
104+ # Mouse movement changes the cursor if it is hovering over an annotation.
105+ # In that state, clicking means dragging an annotation.
106+ # Thus, we only change restore the Cursor once we are not dragging the annotation anymore.
104107 def canvasMoveEvent (self , e : QEvent ) -> None :
105108 hovering = self .check_annotation_hover (e .pos ())
106109 if hovering and not QApplication .overrideCursor () == QtCore .Qt .CursorShape .OpenHandCursor :
@@ -156,6 +159,8 @@ def canvasPressEvent(self, event: QEvent) -> None:
156159
157160 hovering = self .check_annotation_hover (event .pos ())
158161 if hovering :
162+ # clicking should only change the cursor if it is hovering over an annotation.
163+ # The corresponding reset happens in the release event.
159164 QApplication .setOverrideCursor (QtCore .Qt .CursorShape .ClosedHandCursor )
160165 if self .dlg .rubber_band :
161166 self .dlg .rubber_band .reset ()
@@ -175,9 +180,10 @@ def canvasReleaseEvent(self, event: QEvent) -> None:
175180 self .points .append (point )
176181
177182 if self .dragging_vertex :
183+ QApplication .restoreOverrideCursor ()
184+ self .dragging_vertex = False
185+
178186 try :
179- self .dragging_vertex = False
180- QApplication .restoreOverrideCursor ()
181187 crs = self .dlg .canvas .mapSettings ().destinationCrs ()
182188
183189 annotation = self .dlg ._linetool_annotate_point (point , self .move_i , crs = crs )
@@ -205,7 +211,6 @@ def canvasReleaseEvent(self, event: QEvent) -> None:
205211 self .save_last_point (point , annotation )
206212 except ApiError as e :
207213 if self .get_error_code (e ) == 2010 :
208- self .dragging_vertex = False
209214 self .dlg .routing_fromline_list .clear ()
210215 for i , x in enumerate (items ):
211216 coords = x .split (":" )[1 ]
0 commit comments