diff options
| author | Přemysl Janouch <p.janouch@gmail.com> | 2011-03-06 13:54:01 +0100 | 
|---|---|---|
| committer | Přemysl Janouch <p.janouch@gmail.com> | 2011-03-07 17:29:26 +0100 | 
| commit | 6ae08ee4250f369961bb4d06711ce5eb616c5232 (patch) | |
| tree | 78757900bb4125283652d8ab07d88ad1fe4c5db4 | |
| parent | 89b20380d36fe35986fef6b8478a081c1255faff (diff) | |
| download | logdiag-6ae08ee4250f369961bb4d06711ce5eb616c5232.tar.gz logdiag-6ae08ee4250f369961bb4d06711ce5eb616c5232.tar.xz logdiag-6ae08ee4250f369961bb4d06711ce5eb616c5232.zip  | |
Glue to terminal points when creating connections.
| -rw-r--r-- | liblogdiag/ld-diagram-view.c | 28 | 
1 files 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:  | 
