From 3d6bb8063387331e9e8acb2423632a0c722c3038 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Feb 2015 04:59:38 +0000 Subject: Join connections precisely at port borders. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5553 a436a847-0d15-0410-975c-d299462d15a1 --- NEWS | 4 ++-- src/port.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index f4f9d3b..8f94ef8 100644 --- a/NEWS +++ b/NEWS @@ -4,12 +4,12 @@ ganv (1.5.0) unstable; * Fix unexpected node jumping when dragging new connections. * Add support for PDF and PS export. * Improve text rendering at high zoom. - * Line up ports precisely at module border edges. + * Fix various minor visual alignment/sizing issues. * Fix size of vertical flow modules. * Fix compilation with --no-fdgl (patch from Vlad Glagolev). * Fix crash when destroying canvas. - -- David Robillard Tue, 10 Feb 2015 23:50:27 -0500 + -- David Robillard Tue, 10 Feb 2015 23:58:57 -0500 ganv (1.4.2) stable; diff --git a/src/port.c b/src/port.c index f632a7a..8871f54 100644 --- a/src/port.c +++ b/src/port.c @@ -170,19 +170,20 @@ ganv_port_tail_vector(const GanvNode* self, GanvItem* item = &port->box.node.item; GanvCanvas* canvas = ganv_item_get_canvas(item); - const double px = item->impl->x; - const double py = item->impl->y; + const double px = item->impl->x; + const double py = item->impl->y; + const double border_width = GANV_NODE(port)->impl->border_width; switch (ganv_canvas_get_direction(canvas)) { case GANV_DIRECTION_RIGHT: - *x = px + ganv_box_get_width(&port->box); + *x = px + ganv_box_get_width(&port->box) + (border_width / 2.0); *y = py + ganv_box_get_height(&port->box) / 2.0; *dx = 1.0; *dy = 0.0; break; case GANV_DIRECTION_DOWN: *x = px + ganv_box_get_width(&port->box) / 2.0; - *y = py + ganv_box_get_height(&port->box); + *y = py + ganv_box_get_height(&port->box) + (border_width / 2.0); *dx = 0.0; *dy = 1.0; break; @@ -203,19 +204,20 @@ ganv_port_head_vector(const GanvNode* self, GanvItem* item = &port->box.node.item; GanvCanvas* canvas = ganv_item_get_canvas(item); - const double px = item->impl->x; - const double py = item->impl->y; + const double px = item->impl->x; + const double py = item->impl->y; + const double border_width = GANV_NODE(port)->impl->border_width; switch (ganv_canvas_get_direction(canvas)) { case GANV_DIRECTION_RIGHT: - *x = px; + *x = px - (border_width / 2.0); *y = py + ganv_box_get_height(&port->box) / 2.0; *dx = -1.0; *dy = 0.0; break; case GANV_DIRECTION_DOWN: *x = px + ganv_box_get_width(&port->box) / 2.0; - *y = 0.0; + *y = py - (border_width / 2.0); *dx = 0.0; *dy = -1.0; break; -- cgit v1.2.1