mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Some code cleanup for #1515
This commit is contained in:
parent
9f4bc8d7a3
commit
8792d142b3
1 changed files with 7 additions and 10 deletions
|
@ -750,27 +750,24 @@ PathItem.inject(new function() {
|
||||||
// first operand.
|
// first operand.
|
||||||
var wind = null;
|
var wind = null;
|
||||||
if (operator.subtract && path2) {
|
if (operator.subtract && path2) {
|
||||||
// calculate path winding at point depending on operand
|
// Calculate path winding at point depending on operand.
|
||||||
var pathWinding = operand === path1
|
var pathWinding = operand === path1
|
||||||
? path2._getWinding(pt, dir, true)
|
? path2._getWinding(pt, dir, true)
|
||||||
: path1._getWinding(pt, dir, true);
|
: path1._getWinding(pt, dir, true);
|
||||||
// if curve should be omitted
|
// Check if curve should be omitted.
|
||||||
if (operand === path1 && pathWinding.winding ||
|
if (operand === path1 && pathWinding.winding ||
|
||||||
operand === path2 && !pathWinding.winding) {
|
operand === path2 && !pathWinding.winding) {
|
||||||
// if quality is not good enough
|
// Check if quality is not good enough...
|
||||||
if (pathWinding.quality < 1) {
|
if (pathWinding.quality < 1) {
|
||||||
// skip this point
|
// ...and if so, skip this point...
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// omit curve
|
// ...otherwise, omit this curve.
|
||||||
wind = {winding: 0, quality: 1};
|
wind = { winding: 0, quality: 1 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// default case
|
wind = wind || getWinding(pt, curves, dir, true);
|
||||||
if (wind === null) {
|
|
||||||
wind = getWinding(pt, curves, dir, true);
|
|
||||||
}
|
|
||||||
if (wind.quality > winding.quality)
|
if (wind.quality > winding.quality)
|
||||||
winding = wind;
|
winding = wind;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue