mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Switch back to sampling winding at t = 1/4, 2/4, 3/4
Due to curve-time clamping, this should now be OK. Relates to #1073
This commit is contained in:
parent
8ba6e19a2c
commit
50c910b03a
1 changed files with 6 additions and 7 deletions
|
@ -644,16 +644,15 @@ PathItem.inject(new function() {
|
|||
totalLength += length;
|
||||
segment = segment.getNext();
|
||||
} while (segment && !segment._intersection && segment !== start);
|
||||
// Determine winding at three points in the chain. If a winding with
|
||||
// sufficient quality is found, use it. Otherwise use the winding with
|
||||
// the best quality.
|
||||
var offsets = [0.48, 0.1, 0.9],
|
||||
windingZero = { winding: 0, quality: 0 },
|
||||
// Sample winding at up to three points in the chain, until a winding
|
||||
// with sufficient quality is found. The winding with the best quality
|
||||
// is used otherwise.
|
||||
var windingZero = { winding: 0, quality: 0 },
|
||||
winding = windingZero,
|
||||
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
||||
tMax = 1 - tMin;
|
||||
for (var i = 0; i < offsets.length && winding.quality < 0.5; i++) {
|
||||
var length = totalLength * offsets[i];
|
||||
for (var i = 0; i < 3 && winding.quality < 0.5; i++) {
|
||||
var length = totalLength * (i + 1) / 4;
|
||||
for (var j = 0, l = chain.length; j < l; j++) {
|
||||
var entry = chain[j],
|
||||
curveLength = entry.length;
|
||||
|
|
Loading…
Reference in a new issue