From: erg Date: Wed, 22 Nov 2006 17:54:52 +0000 (+0000) Subject: Adjust bounding box calculations. It now ignores virtual nodes, since the X-Git-Tag: LAST_LIBGRAPH~32^2~5814 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67a20663177947c8fe32ae4ba9f9e1a682533f49;p=graphviz Adjust bounding box calculations. It now ignores virtual nodes, since the space alloted for these is not part of the drawing and can cause too much space around the graph. Spline control points have always been used in the bb calculation. The only other change to is to make sure ordinary edge labels are included in the bb. --- diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 5790df664..bf25b1c72 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -373,8 +373,10 @@ void dot_splines(graph_t * g) /* place regular edge labels */ for (n = GD_nlist(g); n; n = ND_next(n)) { - if ((ND_node_type(n) == VIRTUAL) && (ND_label(n))) + if ((ND_node_type(n) == VIRTUAL) && (ND_label(n))) { place_vnlabel(n); + updateBB(g, ND_label(n)); + } } /* normalize splines so they always go from tail to head */ diff --git a/lib/dotgen/position.c b/lib/dotgen/position.c index 855596251..85e8a57c4 100644 --- a/lib/dotgen/position.c +++ b/lib/dotgen/position.c @@ -882,11 +882,15 @@ static void dot_compute_bb(graph_t * g, graph_t * root) continue; if ((v = GD_rank(g)[r].v[0]) == NULL) continue; - x = ND_coord_i(v).x - ND_lw_i(v); - LL.x = MIN(LL.x, x); + if (ND_node_type(v) == NORMAL) { + x = ND_coord_i(v).x - ND_lw_i(v); + LL.x = MIN(LL.x, x); + } v = GD_rank(g)[r].v[GD_rank(g)[r].n - 1]; - x = ND_coord_i(v).x + ND_rw_i(v); - UR.x = MAX(UR.x, x); + if (ND_node_type(v) == NORMAL) { + x = ND_coord_i(v).x + ND_rw_i(v); + UR.x = MAX(UR.x, x); + } } offset = CL_OFFSET; for (c = 1; c <= GD_n_cluster(g); c++) {