From 6ae08ee4250f369961bb4d06711ce5eb616c5232 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sun, 6 Mar 2011 13:54:01 +0100
Subject: Glue to terminal points when creating connections.
---
liblogdiag/ld-diagram-view.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/liblogdiag/ld-diagram-view.c b/liblogdiag/ld-diagram-view.c
index 929d8a0..212bf4f 100644
--- a/liblogdiag/ld-diagram-view.c
+++ b/liblogdiag/ld-diagram-view.c
@@ -1784,10 +1784,24 @@ oper_connect_motion (LdDiagramView *self, const LdPoint *point)
data = &OPER_DATA (self, connect);
- ld_diagram_view_widget_to_diagram_coords (self,
- point->x, point->y, &diagram_x, &diagram_y);
- end_point.x = floor (diagram_x - data->origin.x + 0.5);
- end_point.y = floor (diagram_y - data->origin.y + 0.5);
+ check_terminals (self, point);
+
+ if (self->priv->terminal.x == data->origin.x
+ && self->priv->terminal.y == data->origin.y)
+ self->priv->terminal_hovered = FALSE;
+
+ if (self->priv->terminal_hovered)
+ {
+ end_point.x = self->priv->terminal.x - data->origin.x;
+ end_point.y = self->priv->terminal.y - data->origin.y;
+ }
+ else
+ {
+ ld_diagram_view_widget_to_diagram_coords (self,
+ point->x, point->y, &diagram_x, &diagram_y);
+ end_point.x = floor (diagram_x - data->origin.x + 0.5);
+ end_point.y = floor (diagram_y - data->origin.y + 0.5);
+ }
points = create_connection_path (&end_point);
@@ -1795,12 +1809,6 @@ oper_connect_motion (LdDiagramView *self, const LdPoint *point)
ld_diagram_connection_set_points (data->connection, points);
ld_point_array_free (points);
queue_object_draw (self, LD_DIAGRAM_OBJECT (data->connection));
-
- check_terminals (self, point);
-
- if (self->priv->terminal.x == data->origin.x
- && self->priv->terminal.y == data->origin.y)
- self->priv->terminal_hovered = FALSE;
}
/* create_connection_path:
--
cgit v1.2.3-70-g09d2