From 5e0374a49d18c8fe8e39085b66ff7e1657f75f96 Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 6 Mar 2008 17:51:17 +0000 Subject: [PATCH] labelloc over images - it would help if I tested it before committing --- lib/common/shapes.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/common/shapes.c b/lib/common/shapes.c index 6a658cbbb..4c92a91f0 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -696,7 +696,7 @@ static void poly_init(node_t * n) pointf P, Q, R; pointf *vertices; char *p, *sfile; - double temp, alpha, beta, gamma, delta, dy; + double temp, alpha, beta, gamma; double orientation, distortion, skew; double sectorangle, sidelength, skewdist, gdistortion, gskew; double angle, sinx, cosx, xmax, ymax, scalex, scaley; @@ -863,7 +863,6 @@ static void poly_init(node_t * n) /* FIXME - for odd-sided polygons, e.g. triangles, there * would be a better fit with some vertical adjustment of the shape */ } - bb.y = height; } /* at this point, bb is the minimum size of node that can hold the label */ @@ -892,16 +891,22 @@ static void poly_init(node_t * n) /* adjust text horizontal justification */ if (!mapbool(late_string(n, N_nojustify, "false"))) { - if (bb.x > min_bb.x) - ND_label(n)->d.x = bb.x - min_bb.x; + temp = bb.x - min_bb.x; + if (dimen.x < imagesize.x) + temp += imagesize.x - dimen.x; + if (temp > 0) + ND_label(n)->d.x = temp; } /* adjust text vertical location */ - if ((dy = bb.y - min_bb.y) > 0) { + temp = bb.y - min_bb.y; + if (dimen.y < (double)imagesize.y) + temp += imagesize.y - dimen.y; + if (temp > 0) { if (labelloc < 0) - ND_label(n)->d.y = -dy; + ND_label(n)->d.y = -temp; else if (labelloc > 0) - ND_label(n)->d.y = dy; + ND_label(n)->d.y = temp; else ND_label(n)->d.y = 0; } @@ -1009,8 +1014,7 @@ static void poly_init(node_t * n) temp = GAP / sin(gamma); /*convert this distance to x and y */ - delta = alpha - gamma; - sincos(delta, &sinx, &cosx); + sincos((alpha - gamma), &sinx, &cosx); sinx *= temp; cosx *= temp; -- 2.40.0