mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Streamline CurveLocation#getTangent/Normal/Curvature getter definitions to align with definitions in Curve, Path and PathIterator.
This commit is contained in:
parent
8b4f59962e
commit
b8530935a7
1 changed files with 8 additions and 10 deletions
|
@ -286,14 +286,12 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
parts.push('distance: ' + f.number(this._distance));
|
parts.push('distance: ' + f.number(this._distance));
|
||||||
return '{ ' + parts.join(', ') + ' }';
|
return '{ ' + parts.join(', ') + ' }';
|
||||||
}
|
}
|
||||||
}, Base.each(['Tangent', 'Normal', 'Curvature'],
|
}, Base.each(['getTangent', 'getNormal', 'getCurvature'], function(name) {
|
||||||
// Produce getters for #getTangent() / #getNormal() / #getCurvature()
|
// Produce getters for #getTangent() / #getNormal() / #getCurvature()
|
||||||
function(name) {
|
var get = name + 'At';
|
||||||
var get = 'get' + name + 'At';
|
this[name] = function() {
|
||||||
this['get' + name] = function() {
|
var parameter = this.getParameter(),
|
||||||
var parameter = this.getParameter(),
|
curve = this.getCurve();
|
||||||
curve = this.getCurve();
|
return parameter != null && curve && curve[get](parameter, true);
|
||||||
return parameter != null && curve && curve[get](parameter, true);
|
};
|
||||||
};
|
}, {}));
|
||||||
}, {}
|
|
||||||
));
|
|
||||||
|
|
Loading…
Reference in a new issue