mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Docs: Document Path#getNearestLocation() and #getNearestPoint().
This commit is contained in:
parent
c8578658ae
commit
a8c08b3301
1 changed files with 18 additions and 0 deletions
|
@ -1174,6 +1174,15 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
return loc && loc.getNormal();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the nearest location on the path to the specified point.
|
||||
*
|
||||
* @name Path#getNearestLocation
|
||||
* @function
|
||||
* @param point {Point} The point for which we search the nearest location
|
||||
* @return {CurveLocation} The location on the path that's the closest to
|
||||
* the specified point
|
||||
*/
|
||||
getNearestLocation: function(point, matrix) {
|
||||
var curves = this.getCurves(),
|
||||
minDist = Infinity,
|
||||
|
@ -1188,6 +1197,15 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
return minLoc;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the nearest point on the path to the specified point.
|
||||
*
|
||||
* @name Path#getNearestPoint
|
||||
* @function
|
||||
* @param point {Point} The point for which we search the nearest point
|
||||
* @return {Point} The point on the path that's the closest to the specified
|
||||
* point
|
||||
*/
|
||||
getNearestPoint: function(point, matrix) {
|
||||
return this.getNearestLocation(point, matrix).getPoint();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue