mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Add CurveLocation#distance, for Curve#getNearestLocation().
This commit is contained in:
parent
0c0807e3e9
commit
c35133fae9
1 changed files with 12 additions and 1 deletions
|
@ -37,10 +37,11 @@ CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
|||
* @param {Number} parameter
|
||||
* @param {Point} point
|
||||
*/
|
||||
initialize: function(curve, parameter, point) {
|
||||
initialize: function(curve, parameter, point, distance) {
|
||||
this._curve = curve;
|
||||
this._parameter = parameter;
|
||||
this._point = point;
|
||||
this._distance = distance;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -176,6 +177,16 @@ CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
|||
&& this._curve.getNormal(parameter);
|
||||
},
|
||||
|
||||
/**
|
||||
* The distance from the queried point to the returned location.
|
||||
*
|
||||
* @type Number
|
||||
* @bean
|
||||
*/
|
||||
getDistance: function() {
|
||||
return this._distance;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {String} A string representation of the curve location.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue