mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Improve handling of locations with invalid curves in divideLocations()
This commit is contained in:
parent
b743f456b3
commit
0018b69e4d
1 changed files with 14 additions and 12 deletions
|
@ -302,19 +302,21 @@ PathItem.inject(new function() {
|
||||||
// a change in the cached location values, see above.
|
// a change in the cached location values, see above.
|
||||||
curve = loc._curve,
|
curve = loc._curve,
|
||||||
segment;
|
segment;
|
||||||
if (curve && curve !== prevCurve) {
|
if (curve) {
|
||||||
// This is a new curve, update clearHandles setting.
|
if (curve !== prevCurve) {
|
||||||
clearHandles = !curve.hasHandles()
|
// This is a new curve, update clearHandles setting.
|
||||||
|| clearLookup && clearLookup[getId(curve)];
|
clearHandles = !curve.hasHandles()
|
||||||
// Only keep track of information for rescaling within the curve
|
|| clearLookup && clearLookup[getId(curve)];
|
||||||
rescaleLocs = [];
|
// Only keep track of rescaling information within the curve
|
||||||
prevTime = null;
|
rescaleLocs = [];
|
||||||
} else if (prevTime > tMin) {
|
prevTime = null;
|
||||||
// Rescale curve-time when we are splitting the same curve
|
} else if (prevTime > tMin) {
|
||||||
// multiple times, if splitting was done previously.
|
// Rescale curve-time when we are splitting the same curve
|
||||||
loc._time /= prevTime;
|
// multiple times, if splitting was done previously.
|
||||||
|
loc._time /= prevTime;
|
||||||
|
}
|
||||||
|
prevCurve = curve;
|
||||||
}
|
}
|
||||||
prevCurve = curve;
|
|
||||||
if (exclude) {
|
if (exclude) {
|
||||||
// Store this excluded location for later rescaling, in case we
|
// Store this excluded location for later rescaling, in case we
|
||||||
// divide the same curve further to the left of this location.
|
// divide the same curve further to the left of this location.
|
||||||
|
|
Loading…
Reference in a new issue