summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-02-11 04:59:38 +0000
committerDavid Robillard <d@drobilla.net>2015-02-11 04:59:38 +0000
commit3d6bb8063387331e9e8acb2423632a0c722c3038 (patch)
tree671e0c8ce17aba2ad5d5bd6ef99bc7ab7c540a6e
parent6b28131cfd12437d5b5967bd37ad3bc0fcc12088 (diff)
downloadganv-3d6bb8063387331e9e8acb2423632a0c722c3038.tar.gz
ganv-3d6bb8063387331e9e8acb2423632a0c722c3038.tar.bz2
ganv-3d6bb8063387331e9e8acb2423632a0c722c3038.zip
Join connections precisely at port borders.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5553 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--NEWS4
-rw-r--r--src/port.c18
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 <d@drobilla.net> Tue, 10 Feb 2015 23:50:27 -0500
+ -- David Robillard <d@drobilla.net> 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;