From: Michael J G. <mic...@us...> - 2012-05-10 08:28:25
|
Currently, pos is relative to (arclength - constrictionlen) which makes it very hard to position arrow heads correctly at, say, quarter circles etc. Make it relative to the full arclength to ease positioning of the arrow heads. This requires putting in a safeguard (so that arrow heads do no come out before nor after that path) which may be of independent interest. Signed-off-by: Michael J Gruber <mic...@us...> --- pyx/deco.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyx/deco.py b/pyx/deco.py index 2231899..84ae7f0 100644 --- a/pyx/deco.py +++ b/pyx/deco.py @@ -472,7 +472,8 @@ class arrow(deco, attr.attr): constrictionlen = self.size * 1 * math.cos(math.radians(self.angle/2.0)) arrowheadconstrictionlen = None - arclenfrombegin = (1-2*self.reversed)*constrictionlen + self.pos * (anormpath.arclen() - constrictionlen) + arclenfrombegin = (1-2*self.reversed)*constrictionlen + self.pos * anormpath.arclen() + arclenfrombegin = min(anormpath.arclen(), max(0, arclenfrombegin)) direction = self.reversed and -1 or 1 arrowhead = _arrowhead(anormpath, arclenfrombegin, direction, self.size, self.angle, arrowheadconstrictionlen) -- 1.7.10.1.702.g60a8c8a |