mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-13 16:33:28 -04:00
Use CurveLocation for Curve#getNearest*() methods.
This commit is contained in:
parent
8b6d9746ce
commit
17bdaf6fe4
1 changed files with 4 additions and 4 deletions
|
@ -803,7 +803,7 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
|
|||
}
|
||||
|
||||
return {
|
||||
getNearestParameterFor: function(point) {
|
||||
getNearestLocation: function(point) {
|
||||
var p1 = this._segment1._point,
|
||||
h1 = this._segment1._handleOut,
|
||||
h2 = this._segment2._handleIn,
|
||||
|
@ -821,11 +821,11 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
|
|||
best = roots[i];
|
||||
}
|
||||
}
|
||||
return best;
|
||||
return new CurveLocation(this, best);
|
||||
},
|
||||
|
||||
getNearestPointFor: function(point) {
|
||||
return this.getPoint(this.getNearestParameterFor(point));
|
||||
getNearestPoint: function(point) {
|
||||
return this.getNearestLocation(point).getPoint();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue