diff --git a/annotationscene.py b/annotationscene.py index af669e3..11b7a8b 100644 --- a/annotationscene.py +++ b/annotationscene.py @@ -137,10 +137,11 @@ class AnnotationScene(QGraphicsScene): def mousePressEvent(self, event): if self.debug_: print "mousePressEvent", self.sceneRect().contains(event.scenePos()), event.scenePos() - if not self.sceneRect().contains(event.scenePos()): - # ignore events outside the scene rect - return - elif self.inserter_ is not None: + if self.inserter_ is not None: + if not self.sceneRect().contains(event.scenePos()) and \ + not self.inserter_.allowOutOfSceneEvents(): + # ignore events outside the scene rect + return # insert mode self.inserter_.mousePressEvent(event, self.root_) else: diff --git a/items/inserters.py b/items/inserters.py index bb023ca..a135bd9 100644 --- a/items/inserters.py +++ b/items/inserters.py @@ -29,6 +29,9 @@ class ItemInserter: def keyPressEvent(self, event, index): event.ignore() + def allowOutOfSceneEvents(self): + return False + class PointItemInserter(ItemInserter): def mousePressEvent(self, event, index): pos = event.scenePos()