diff options
author | kitfox | 2013-01-11 09:40:02 +0100 |
---|---|---|
committer | kitfox | 2013-01-11 09:40:02 +0100 |
commit | 1b4139631a4905ad3a83f9af643d6c78e78c65fe (patch) | |
tree | 7d7ff09e27e43fdce62f00739f6a4fb432b6836c | |
parent | Fixing animation bug. (diff) | |
download | svg-salamander-core-1b4139631a4905ad3a83f9af643d6c78e78c65fe.tar.gz svg-salamander-core-1b4139631a4905ad3a83f9af643d6c78e78c65fe.tar.xz svg-salamander-core-1b4139631a4905ad3a83f9af643d6c78e78c65fe.zip |
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
-rw-r--r-- | src/main/java/com/kitfox/svg/Marker.java | 52 |
1 files 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; |