mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Rename Curve#getParameter(point) to Curve#getParameterOf(point), to better distinguish from Curve#getParameterAt(length).
This commit is contained in:
parent
00898908d3
commit
3c4978eb04
3 changed files with 14 additions and 13 deletions
|
@ -273,6 +273,15 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
|
|||
start !== undefined ? start : offset < 0 ? 1 : 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Point} point
|
||||
* @return {Number}
|
||||
*/
|
||||
getParameterOf: function(point) {
|
||||
point = Point.read(arguments);
|
||||
return Curve.getParameterOf(this.getValues(), point.x, point.y);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the point on the curve at the specified position.
|
||||
*
|
||||
|
@ -304,15 +313,6 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
|
|||
return Curve.evaluate(this.getValues(), parameter, 2);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Point} point
|
||||
* @return {Number}
|
||||
*/
|
||||
getParameter: function(point) {
|
||||
point = Point.read(point);
|
||||
return Curve.getParameter(this.getValues(), point.x, point.y);
|
||||
},
|
||||
|
||||
getIntersections: function(curve) {
|
||||
return Curve._addIntersections(this.getValues(), curve.getValues(),
|
||||
this, []);
|
||||
|
@ -493,7 +493,7 @@ statics: {
|
|||
/*#=*/ Numerical.TOLERANCE);
|
||||
},
|
||||
|
||||
getParameter: function(v, x, y) {
|
||||
getParameterOf: function(v, x, y) {
|
||||
// Handle beginnings and end seperately, as they are not detected
|
||||
// sometimes.
|
||||
if (Math.abs(v[0] - x) < /*#=*/ Numerical.TOLERANCE
|
||||
|
|
|
@ -136,8 +136,9 @@ CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
|||
* @bean
|
||||
*/
|
||||
getParameter: function() {
|
||||
if (this._parameter == null && this._curve && this._point)
|
||||
this._parameter = this._curve.getParameterAt(this._point);
|
||||
if (this._parameter == null && this._curve && this._point) {
|
||||
this._parameter = this._curve.getParameterOf(this._point);
|
||||
}
|
||||
return this._parameter;
|
||||
},
|
||||
|
||||
|
|
|
@ -992,7 +992,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
var curves = this.getCurves();
|
||||
for (var i = 0, l = curves.length; i < l; i++) {
|
||||
var curve = curves[i];
|
||||
var t = curve.getParameter(point);
|
||||
var t = curve.getParameterOf(point);
|
||||
if (t != null)
|
||||
return new CurveLocation(curve, t);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue