mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Remove special handling of winding contribution on overlaps
Looks like the new code handles this correclty now!
This commit is contained in:
parent
5af391d333
commit
c6a38589e9
1 changed files with 2 additions and 21 deletions
|
@ -415,26 +415,7 @@ PathItem.inject(new function() {
|
||||||
// Assign the average winding to the entire curve chain.
|
// Assign the average winding to the entire curve chain.
|
||||||
var winding = Math.round(windingSum / 3);
|
var winding = Math.round(windingSum / 3);
|
||||||
for (var j = chain.length - 1; j >= 0; j--) {
|
for (var j = chain.length - 1; j >= 0; j--) {
|
||||||
var seg = chain[j].segment,
|
chain[j].segment._winding = winding;
|
||||||
inter = seg._intersection,
|
|
||||||
wind = winding;
|
|
||||||
// We need to handle the edge cases of overlapping curves
|
|
||||||
// differently based on the type of operation, and adjust the
|
|
||||||
// winding number accordingly:
|
|
||||||
if (inter && inter._overlap) {
|
|
||||||
switch (operation) {
|
|
||||||
case 'unite':
|
|
||||||
if (wind === 1)
|
|
||||||
wind = 2;
|
|
||||||
break;
|
|
||||||
case 'intersect':
|
|
||||||
if (wind === 2)
|
|
||||||
wind = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
seg._originalWinding = winding;
|
|
||||||
seg._winding = wind;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +532,7 @@ PathItem.inject(new function() {
|
||||||
&& /^(unite|subtract)$/.test(operation)) {
|
&& /^(unite|subtract)$/.test(operation)) {
|
||||||
// Switch to the overlapping intersecting segment if it is
|
// Switch to the overlapping intersecting segment if it is
|
||||||
// part of the boolean result.
|
// part of the boolean result.
|
||||||
if (operator(other._originalWinding)) {
|
if (operator(other._winding)) {
|
||||||
drawSegment(seg, 'overlap-cross', i, 'orange');
|
drawSegment(seg, 'overlap-cross', i, 'orange');
|
||||||
seg = other;
|
seg = other;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue