Skip to content

Commit

Permalink
Merge pull request #616 from gaphor/connect-opposite-handle-on=placement
Browse files Browse the repository at this point in the history
Connect start of line when placed inside an element
  • Loading branch information
danyeaw committed Jan 21, 2021
2 parents 500fbaf + 64f189b commit bcc73f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions gaphor/diagram/diagramtools/grayout.py
Expand Up @@ -44,3 +44,7 @@ def glue(
sink = super().glue(pos, distance)
self.view.selection.dropzone_item = sink and sink.item
return sink

def connect(self, pos: Pos) -> None:
super().connect(pos)
self.view.selection.dropzone_item = None
7 changes: 4 additions & 3 deletions gaphor/diagram/diagramtools/placement.py
Expand Up @@ -92,11 +92,12 @@ def on_drag_update(gesture, offset_x, offset_y, placement_state):

def on_drag_end(gesture, offset_x, offset_y, placement_state):
if placement_state.moving:
view = gesture.get_widget()
_, x, y = gesture.get_start_point()
item = placement_state.moving.item
placement_state.moving.stop_move((x + offset_x, y + offset_y))
placement_state.event_manager.handle(
DiagramItemPlaced(placement_state.moving.item)
)
connect_opposite_handle(view, item, x, y, placement_state.handle_index)
placement_state.event_manager.handle(DiagramItemPlaced(item))


def new_item_factory(
Expand Down

0 comments on commit bcc73f3

Please sign in to comment.