Skip to content

Commit

Permalink
cancel addition properly
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Sep 2, 2023
1 parent 220a3c6 commit c2952de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/python/plotlyst/view/widget/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ def keyPressEvent(self, event: QKeyEvent) -> None:
self.endLink()
elif self.isAdditionMode():
self.cancelItemAddition.emit()
self.endAdditionMode()
else:
self.clearSelection()
elif event.key() == Qt.Key.Key_Delete or event.key() == Qt.Key.Key_Backspace:
Expand Down Expand Up @@ -484,6 +485,7 @@ def mouseReleaseEvent(self, event: 'QGraphicsSceneMouseEvent') -> None:
self.endLink()
elif self.isAdditionMode() and event.button() & Qt.MouseButton.RightButton:
self.cancelItemAddition.emit()
self.endAdditionMode()
elif self._selectionMode and event.button() & Qt.MouseButton.LeftButton:
self._selectionMode = False
self._selectionRect.setVisible(False)
Expand Down

0 comments on commit c2952de

Please sign in to comment.