mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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;
|
||||
} else {
|
||||
// Determine the closest segment by comparing curve lengths
|
||||
var rightCurve = curve.clone().divide(parameter);
|
||||
this._segment = rightCurve.getLength() > curve.getLength() / 2
|
||||
? curve._segment1
|
||||
: curve._segment2;
|
||||
this._segment = curve.getLength(0, parameter)
|
||||
< curve.getLength(parameter, 1)
|
||||
? curve._segment1
|
||||
: curve._segment2;
|
||||
}
|
||||
}
|
||||
return this._segment;
|
||||
|
|
Loading…
Reference in a new issue