mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix addWinding() for special cases
This commit is contained in:
parent
32db1eb005
commit
86d05624c0
1 changed files with 13 additions and 12 deletions
|
@ -544,25 +544,26 @@ PathItem.inject(new function() {
|
||||||
if (winding !== windingPrev) {
|
if (winding !== windingPrev) {
|
||||||
// Curve is crossed at starting point and winding changes
|
// Curve is crossed at starting point and winding changes
|
||||||
// from previous curve. Cancel winding from previous curve.
|
// from previous curve. Cancel winding from previous curve.
|
||||||
if (a3Prev < paR) {
|
if (a0 < paL) {
|
||||||
windingL += winding;
|
windingL += winding;
|
||||||
} else if (a3Prev > paL) {
|
} else if (a0 > paR) {
|
||||||
windingR += winding;
|
windingR += winding;
|
||||||
}
|
}
|
||||||
} else if (a3Prev < paL && a > paL || a3Prev > paR && a < paR) {
|
} else if (a0 != a3Prev) {
|
||||||
// Point is on a horizontal curve between the previous non-
|
// A horizontal curve is between current and previous
|
||||||
// horizontal and the current curve.
|
// non-horizontal curve
|
||||||
if (a3Prev < paL) {
|
if (a3Prev < paR && a > paR) {
|
||||||
// Left winding was added before, now add right winding.
|
// Right winding was not added before, so add it now
|
||||||
windingR += winding;
|
windingR += winding;
|
||||||
} else if (a3Prev > paR) {
|
onPath = true;
|
||||||
// Right winding was added before, now add left winding.
|
} else if (a3Prev > paL && a < paL) {
|
||||||
|
// Left winding was not added before, so add it now
|
||||||
windingL += winding;
|
windingL += winding;
|
||||||
|
onPath = true;
|
||||||
}
|
}
|
||||||
onPath = true;
|
// TODO: Determine how to handle quality when curve is crossed
|
||||||
|
// at starting point. Do we always need to set to 0?
|
||||||
}
|
}
|
||||||
// TODO: Determine how to handle quality when curve is crossed
|
|
||||||
// at starting point. Do we always need to set to 0?
|
|
||||||
quality = 0;
|
quality = 0;
|
||||||
}
|
}
|
||||||
vPrev = v;
|
vPrev = v;
|
||||||
|
|
Loading…
Reference in a new issue