mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
_tracePaths: Switch contours only if necessary
This commit is contained in:
parent
26ef85930d
commit
ea29e65e6b
1 changed files with 6 additions and 9 deletions
|
@ -359,15 +359,11 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
sign = t === 0 ? 2 : (t === 1 ? -2 : 0);
|
sign = t === 0 ? 2 : (t === 1 ? -2 : 0);
|
||||||
if (sign !== 0) {
|
if (sign !== 0) {
|
||||||
i = sign > 0 ? 0 : 6;
|
i = sign > 0 ? 0 : 6;
|
||||||
if (Curve.isLinear(v)) {
|
// Return slope from this point that follows the direction
|
||||||
// Return slope from this point that follows the direction
|
// of the line
|
||||||
// of the line
|
if (Curve.isLinear(v))
|
||||||
sign *= 3;
|
sign *= 3;
|
||||||
tan = new Point(v[i+sign] - v[i], v[i+sign+1] - v[i+1]);
|
tan = new Point(v[i+sign] - v[i], v[i+sign+1] - v[i+1]);
|
||||||
} else {
|
|
||||||
// Return the first or last handle
|
|
||||||
tan = new Point(v[i+sign] - v[i], v[i+sign+1] - v[i+1]);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
tan = Curve.evaluate(v, t, 1);
|
tan = Curve.evaluate(v, t, 1);
|
||||||
}
|
}
|
||||||
|
@ -522,7 +518,8 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
// If the intersection segment is valid, try switching to
|
// If the intersection segment is valid, try switching to
|
||||||
// it, with an appropriate direction to continue traversal.
|
// it, with an appropriate direction to continue traversal.
|
||||||
// else, stay on the same contour.
|
// else, stay on the same contour.
|
||||||
if (ixOther && (ixOtherSeg = ixOther._segment) &&
|
if (!operator(seg._winding) && ixOther &&
|
||||||
|
(ixOtherSeg = ixOther._segment) &&
|
||||||
ixOtherSeg !== startSeg && firstHandleIn) {
|
ixOtherSeg !== startSeg && firstHandleIn) {
|
||||||
entryExitTangents = getEntryExitTangents(seg);
|
entryExitTangents = getEntryExitTangents(seg);
|
||||||
c1 = seg.getCurve();
|
c1 = seg.getCurve();
|
||||||
|
|
Loading…
Reference in a new issue