mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Correctly keep track of all straight curves that need their handles cleared at the end.
Closes #838
This commit is contained in:
parent
b724a59901
commit
a20b0469d6
1 changed files with 8 additions and 7 deletions
|
@ -213,7 +213,7 @@ PathItem.inject(new function() {
|
||||||
var tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
var tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
||||||
tMax = 1 - tMin,
|
tMax = 1 - tMin,
|
||||||
noHandles = false,
|
noHandles = false,
|
||||||
clearSegments = [],
|
clearCurves = [],
|
||||||
prevCurve,
|
prevCurve,
|
||||||
prevT;
|
prevT;
|
||||||
|
|
||||||
|
@ -239,11 +239,12 @@ PathItem.inject(new function() {
|
||||||
// Split the curve at t, passing true for _setHandles to always
|
// Split the curve at t, passing true for _setHandles to always
|
||||||
// set the handles on the sub-curves even if the original curve
|
// set the handles on the sub-curves even if the original curve
|
||||||
// had no handles.
|
// had no handles.
|
||||||
segment = curve.divide(t, true, true)._segment1;
|
var newCurve = curve.divide(t, true, true);
|
||||||
// Keep track of segments of curves without handles, so they can
|
// Keep track of curves without handles, so they can be cleared
|
||||||
// be cleared again at the end.
|
// again at the end.
|
||||||
if (noHandles)
|
if (noHandles)
|
||||||
clearSegments.push(segment);
|
clearCurves.push(curve, newCurve);
|
||||||
|
segment = newCurve._segment1;
|
||||||
}
|
}
|
||||||
loc._setSegment(segment);
|
loc._setSegment(segment);
|
||||||
// Create links from the new segment to the intersection on the
|
// Create links from the new segment to the intersection on the
|
||||||
|
@ -269,8 +270,8 @@ PathItem.inject(new function() {
|
||||||
}
|
}
|
||||||
// Clear segment handles if they were part of a curve with no handles,
|
// Clear segment handles if they were part of a curve with no handles,
|
||||||
// once we are done with the entire curve.
|
// once we are done with the entire curve.
|
||||||
for (var i = 0, l = clearSegments.length; i < l; i++) {
|
for (var i = 0, l = clearCurves.length; i < l; i++) {
|
||||||
clearSegments[i].clearHandles();
|
clearCurves[i].clearHandles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue