mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Some further code cleanup for 3c2588fdec
This commit is contained in:
parent
d52eafc259
commit
31aa68b2d1
1 changed files with 8 additions and 8 deletions
|
@ -635,8 +635,10 @@ PathItem.inject(new function() {
|
||||||
// Determine winding at three points in the chain. If a winding with
|
// Determine winding at three points in the chain. If a winding with
|
||||||
// sufficient quality is found, use it. Otherwise use the winding with
|
// sufficient quality is found, use it. Otherwise use the winding with
|
||||||
// the best quality.
|
// the best quality.
|
||||||
var offsets = [0.48, 0.1, 0.9];
|
var offsets = [0.48, 0.1, 0.9],
|
||||||
for (var i = 0; (!winding || winding.quality < 0.5) && i < offsets.length; i++) {
|
windingZero = { winding: 0, quality: 0 },
|
||||||
|
winding = windingZero;
|
||||||
|
for (var i = 0; i < offsets.length && winding.quality < 0.5; i++) {
|
||||||
var length = totalLength * offsets[i];
|
var length = totalLength * offsets[i];
|
||||||
for (var j = 0, l = chain.length; j < l; j++) {
|
for (var j = 0, l = chain.length; j < l; j++) {
|
||||||
var entry = chain[j],
|
var entry = chain[j],
|
||||||
|
@ -658,17 +660,15 @@ PathItem.inject(new function() {
|
||||||
// While subtracting, we need to omit this curve if it is
|
// While subtracting, we need to omit this curve if it is
|
||||||
// contributing to the second operand and is outside the
|
// contributing to the second operand and is outside the
|
||||||
// first operand.
|
// first operand.
|
||||||
var windingNew = !(operator.subtract && path2 && (
|
var wind = !(operator.subtract && path2 && (
|
||||||
path === path1 &&
|
path === path1 &&
|
||||||
path2._getWinding(pt, dir, true).winding ||
|
path2._getWinding(pt, dir, true).winding ||
|
||||||
path === path2 &&
|
path === path2 &&
|
||||||
!path1._getWinding(pt, dir, true).winding))
|
!path1._getWinding(pt, dir, true).winding))
|
||||||
? getWinding(pt, curves, dir, true)
|
? getWinding(pt, curves, dir, true)
|
||||||
: { winding: 0 };
|
: windingZero;
|
||||||
if (windingNew.winding &&
|
if (wind.quality > winding.quality)
|
||||||
(!winding || winding.quality < windingNew.quality)) {
|
winding = wind;
|
||||||
winding = windingNew;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
length -= curveLength;
|
length -= curveLength;
|
||||||
|
|
Loading…
Reference in a new issue