The arrowhead needs a piece of size "size" of the path for its
construction. Therefore, only (arclen-size) of the path is available as
positions for a head without extending the path.

So, change pos=0 to mean a position at arclenpos=size, and introduce the
necessary additional path exclusions for begin/end arrows.
---
Following up the pos/relarclen discussion, here's a patch within the
current design which prevents the necessity of extrapolating the path.

Also, in contrast to the other patches I sent a minute ago, I managed to set
my author field again...

Signed-off-by: Michael J Gruber <michaeljgru...@users.sourceforge.net>
---
 pyx/deco.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/pyx/deco.py b/pyx/deco.py
index 193f566..e41e88e 100644
--- a/pyx/deco.py
+++ b/pyx/deco.py
@@ -472,7 +472,7 @@ class arrow(deco, attr.attr):
         dp.ensurenormpath()
         anormpath = dp.path
 
-        arclenfrombegin = (1-self.reversed)*self.constrictionlen + self.pos * 
(anormpath.arclen() - self.constrictionlen)
+        arclenfrombegin = (1-self.reversed)*self.size + self.pos * 
(anormpath.arclen() - self.size)
         direction = self.reversed and -1 or 1
         arrowhead = _arrowhead(anormpath, arclenfrombegin, direction, 
self.size, self.angle,
                                self.constriction is not None, 
self.constrictionlen)
@@ -481,10 +481,16 @@ class arrow(deco, attr.attr):
         dp.ornaments.draw(arrowhead, self.attrs)
 
         # exlude part of the path from stroking when the arrow is strictly at 
the begin or the end
-        if self.pos == 0 and self.reversed:
-            dp.excluderange(0, min(self.size, self.constrictionlen))
-        elif self.pos == 1 and not self.reversed:
-            dp.excluderange(anormpath.end() - min(self.size, 
self.constrictionlen), anormpath.end())
+        if self.pos == 0:
+            if self.reversed:
+                dp.excluderange(0, min(self.size, self.constrictionlen))
+            else:
+                dp.excluderange(0, min(self.size, self.size - 
self.constrictionlen))
+        elif self.pos == 1:
+            if self.reversed:
+                dp.excluderange(anormpath.end() - min(self.size, self.size - 
self.constrictionlen), anormpath.end())
+            else:
+                dp.excluderange(anormpath.end() - min(self.size, 
self.constrictionlen), anormpath.end())
 
 arrow.clear = attr.clearclass(arrow)
 
-- 
1.7.11.rc0.265.g7c5e375


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PyX-devel mailing list
PyX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyx-devel

Reply via email to