Streamline CurveLocation#getTangent/Normal/Curvature getter definitions to align with definitions in Curve, Path and PathIterator.

This commit is contained in:
Jürg Lehni 2014-09-27 22:03:20 +02:00
parent 8b4f59962e
commit b8530935a7

View file

@ -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);
};
}, {}));