From 1b4139631a4905ad3a83f9af643d6c78e78c65fe Mon Sep 17 00:00:00 2001 From: kitfox Date: Fri, 11 Jan 2013 08:40:02 +0000 Subject: Fixing marker rotation issue for knots coincident with end points. git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@142 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b --- src/main/java/com/kitfox/svg/Marker.java | 52 ++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/kitfox/svg/Marker.java b/src/main/java/com/kitfox/svg/Marker.java index 6909f68..511fbca 100644 --- a/src/main/java/com/kitfox/svg/Marker.java +++ b/src/main/java/com/kitfox/svg/Marker.java @@ -215,6 +215,28 @@ public class Marker extends Group double k0y = coords[1]; double x = coords[2]; double y = coords[3]; + + + //Best in tangent + if (px != k0x || py != k0y) + { + markerIn(px, py, k0x - px, k0y - py); + } + else + { + markerIn(px, py, x - px, y - py); + } + + //Best out tangent + if (x != k0x || y != k0y) + { + markerOut(x, y, x - k0x, y - k0y); + } + else + { + markerOut(x, y, x - px, y - py); + } + markerIn(px, py, k0x - px, k0y - py); markerOut(x, y, x - k0x, y - k0y); px = x; @@ -229,8 +251,34 @@ public class Marker extends Group double k1y = coords[3]; double x = coords[4]; double y = coords[5]; - markerIn(px, py, k0x - px, k0y - py); - markerOut(x, y, x - k1x, y - k1y); + + //Best in tangent + if (px != k0x || py != k0y) + { + markerIn(px, py, k0x - px, k0y - py); + } + else if (px != k1x || py != k1y) + { + markerIn(px, py, k1x - px, k1y - py); + } + else + { + markerIn(px, py, x - px, y - py); + } + + //Best out tangent + if (x != k1x || y != k1y) + { + markerOut(x, y, x - k1x, y - k1y); + } + else if (x != k0x || y != k0y) + { + markerOut(x, y, x - k0x, y - k0y); + } + else + { + markerOut(x, y, x - px, y - py); + } px = x; py = y; break; -- cgit v1.2.3-55-g7522