Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions orangecanvas/document/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def __init__(self, document, parent=None, deleteOnEnd=True):
self.deleteOnEnd = deleteOnEnd

self.cancelOnEsc = False
self.extendedOnShift = False

self.__finished = False
self.__canceled = False
Expand Down Expand Up @@ -1415,6 +1416,9 @@ def mouseReleaseEvent(self, event):
p1, p2 = map(self.arrow_item.mapFromScene, (p1, p2))
self.arrow_item.setLine(QLineF(p1, p2))

if event.modifiers() & Qt.ShiftModifier:
self.extendedOnShift = True

self.end()
return True
else:
Expand Down
12 changes: 10 additions & 2 deletions orangecanvas/document/schemeedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ def __toggleNewArrowAnnotation(self, checked):
handler = self.__scene.user_interaction_handler
if isinstance(handler, interactions.NewArrowAnnotation):
# Cancel the interaction and restore the state
handler.ended.disconnect(action.toggle)
handler.ended.disconnect(self.__toggleNewArrowAction)
handler.cancel(interactions.UserInteraction.UserCancelReason)
log.info("Canceled new arrow annotation")

Expand All @@ -1922,10 +1922,18 @@ def __toggleNewArrowAnnotation(self, checked):
checked_action = self.__arrowColorActionGroup.checkedAction()
handler.setColor(checked_action.data())

handler.ended.connect(action.toggle)
handler.ended.connect(self.__toggleNewArrowAction)

self._setUserInteractionHandler(handler)

def __toggleNewArrowAction(self):
handler = self.sender()
action = self.__newArrowAnnotationAction
action.toggle() # end current
if handler.extendedOnShift:
handler.extendedOnShift = False # clear shift flag
action.toggle() # start new

def __onFontSizeTriggered(self, action):
# type: (QAction) -> None
if not self.__newTextAnnotationAction.isChecked():
Expand Down
Loading