Implement Path#getLocation(point)

This commit is contained in:
Jürg Lehni 2011-07-09 17:12:27 +02:00
parent 55f815cb72
commit 254aee47f8

View file

@ -936,7 +936,17 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
return null;
},
// TODO: getLocationAt(point, precision)
getLocation: function(point) {
var curves = this.getCurves();
for (var i = 0, l = curves.length; i < l; i++) {
var curve = curves[i];
var t = curve.getParameter(point);
if (t != null)
return new CurveLocation(curve, t);
}
return null;
},
// PORT: Rename functions and add new isParameter argument in Scriptographer
// DOCS: document Path#getLocationAt
/**