mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Clean up previous commit.
This commit is contained in:
parent
445d8ae22f
commit
4c12f1505c
1 changed files with 6 additions and 9 deletions
|
@ -729,21 +729,20 @@ PathItem.inject(new function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var i = 0, l = segments.length; i < l; i++) {
|
for (var i = 0, l = segments.length; i < l; i++) {
|
||||||
var path = null,
|
var seg = segments[i],
|
||||||
|
path = null,
|
||||||
finished = false,
|
finished = false,
|
||||||
closed = true,
|
closed = true,
|
||||||
branches = [],
|
branches = [],
|
||||||
branch,
|
branch,
|
||||||
visited,
|
visited,
|
||||||
seg = segments[i],
|
|
||||||
inter = seg._intersection,
|
|
||||||
handleIn;
|
handleIn;
|
||||||
// If all encountered segments in a path are overlaps, we may have
|
// If all encountered segments in a path are overlaps, we may have
|
||||||
// two fully overlapping paths that need special handling.
|
// two fully overlapping paths that need special handling.
|
||||||
if (!seg._visited && seg._path._overlapsOnly) {
|
if (!seg._visited && seg._path._overlapsOnly) {
|
||||||
// TODO: Don't we also need to check for multiple overlaps?
|
// TODO: Don't we also need to check for multiple overlaps?
|
||||||
var path1 = seg._path,
|
var path1 = seg._path,
|
||||||
path2 = inter._segment._path;
|
path2 = seg._intersection._segment._path;
|
||||||
if (path1.compare(path2)) {
|
if (path1.compare(path2)) {
|
||||||
// Only add the path to the result if it has an area.
|
// Only add the path to the result if it has an area.
|
||||||
if ((operator.unite || operator.intersect)
|
if ((operator.unite || operator.intersect)
|
||||||
|
@ -804,12 +803,11 @@ PathItem.inject(new function() {
|
||||||
branch = null;
|
branch = null;
|
||||||
}
|
}
|
||||||
if (!branch) {
|
if (!branch) {
|
||||||
visited = [];
|
|
||||||
branch = {
|
branch = {
|
||||||
start: path._segments.length,
|
start: path._segments.length,
|
||||||
segment: seg,
|
segment: seg,
|
||||||
handleIn: handleIn,
|
handleIn: handleIn,
|
||||||
visited: visited
|
visited: visited = []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (cross)
|
if (cross)
|
||||||
|
@ -832,10 +830,9 @@ PathItem.inject(new function() {
|
||||||
// Now restore the previous branch and keep adding to it,
|
// Now restore the previous branch and keep adding to it,
|
||||||
// since we don't cross here anymore.
|
// since we don't cross here anymore.
|
||||||
branch = branches.pop();
|
branch = branches.pop();
|
||||||
if (!branch) {
|
// Stop once we run out of branches to try.
|
||||||
console.log('run out of branches, breaking.');
|
if (!branch)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Add the segment to the path, and mark it as visited.
|
// Add the segment to the path, and mark it as visited.
|
||||||
// But first we need to look ahead. If we encounter the end of
|
// But first we need to look ahead. If we encounter the end of
|
||||||
|
|
Loading…
Reference in a new issue