mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -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();
|
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) {
|
getNearestLocation: function(point, matrix) {
|
||||||
var curves = this.getCurves(),
|
var curves = this.getCurves(),
|
||||||
minDist = Infinity,
|
minDist = Infinity,
|
||||||
|
@ -1188,6 +1197,15 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
return minLoc;
|
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) {
|
getNearestPoint: function(point, matrix) {
|
||||||
return this.getNearestLocation(point, matrix).getPoint();
|
return this.getNearestLocation(point, matrix).getPoint();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue