1. Marko Toplak
  2. orange

Commits

Marko Toplak  committed 7ce4e55 Draft

When dragging widgets, a a new widget should be placed so that the connection stays as it was.

  • Participants
  • Parent commits 7e6b10d
  • Branches default

Comments (0)

Files changed (1)

File Orange/OrangeCanvas/document/interactions.py

View file
             item = action.property("item").toPyObject()
             desc = item.data(QtWidgetRegistry.WIDGET_DESC_ROLE).toPyObject()
             pos = event.scenePos()
+            #a new widget should be placed so that the connection
+            #stays as it was
+            offset = 31*(-1 if self.direction == self.FROM_SINK else 
+                        1 if self.direction == self.FROM_SOURCE else 0)
             node = self.document.newNodeHelper(desc,
-                                               position=(pos.x(), pos.y()))
+                                               position=(pos.x()+offset, pos.y()))
             return node