mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Use Curve#getLength(from, to) rather than cloning and dividing.
This commit is contained in:
parent
346493fb7c
commit
c2fbcbcaa8
1 changed files with 4 additions and 4 deletions
|
@ -37,10 +37,10 @@ CurveLocation = Base.extend({
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
// Determine the closest segment by comparing curve lengths
|
// Determine the closest segment by comparing curve lengths
|
||||||
var rightCurve = curve.clone().divide(parameter);
|
this._segment = curve.getLength(0, parameter)
|
||||||
this._segment = rightCurve.getLength() > curve.getLength() / 2
|
< curve.getLength(parameter, 1)
|
||||||
? curve._segment1
|
? curve._segment1
|
||||||
: curve._segment2;
|
: curve._segment2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._segment;
|
return this._segment;
|
||||||
|
|
Loading…
Reference in a new issue