mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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));
|
||||
return '{ ' + parts.join(', ') + ' }';
|
||||
}
|
||||
}, Base.each(['Tangent', 'Normal', 'Curvature'],
|
||||
}, Base.each(['getTangent', 'getNormal', 'getCurvature'], function(name) {
|
||||
// Produce getters for #getTangent() / #getNormal() / #getCurvature()
|
||||
function(name) {
|
||||
var get = 'get' + name + 'At';
|
||||
this['get' + name] = function() {
|
||||
var parameter = this.getParameter(),
|
||||
curve = this.getCurve();
|
||||
return parameter != null && curve && curve[get](parameter, true);
|
||||
};
|
||||
}, {}
|
||||
));
|
||||
var get = name + 'At';
|
||||
this[name] = function() {
|
||||
var parameter = this.getParameter(),
|
||||
curve = this.getCurve();
|
||||
return parameter != null && curve && curve[get](parameter, true);
|
||||
};
|
||||
}, {}));
|
||||
|
|
Loading…
Reference in a new issue