diff --git a/CHANGELOG.md b/CHANGELOG.md index 5150ef52..7e64c933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -169,6 +169,8 @@ contribute to the code. matrix (#972). - Allow `Item#position` to be selected via `Item#position.selected` (#980). - Add `tolerance` argument to `Path#join(path, tolerance)`. +- Add `Curve#getOffsetAtTime(time)`, as the reverse of + `Curve#getTimeAt(offset)`. ### Fixed - Fix calculations of `Item#strokeBounds` for all possible combinations of diff --git a/dist/docs/assets/js/paper.js b/dist/docs/assets/js/paper.js index 4406fffa..63a0f599 100644 --- a/dist/docs/assets/js/paper.js +++ b/dist/docs/assets/js/paper.js @@ -9,7 +9,7 @@ * * All rights reserved. * - * Date: Sun Jun 12 17:07:43 2016 +0200 + * Date: Sun Jun 12 18:32:05 2016 +0200 * *** * @@ -6380,6 +6380,10 @@ statics: { getParameterAt: '#getTimeAt', + getOffsetAtTime: function(t) { + return this.getPartLength(0, t); + }, + getLocationOf: function() { return this.getLocationAtTime(this.getTimeOf(Point.read(arguments))); }, @@ -6417,7 +6421,7 @@ new function() { this[name + 'At'] = function(location, _isTime) { var values = this.getValues(); return Curve[name](values, _isTime ? location - : Curve.getTimeAt(values, location, 0)); + : Curve.getTimeAt(values, location)); }; this[name + 'AtTime'] = function(time) { @@ -7218,8 +7222,8 @@ var CurveLocation = Base.extend({ function isInRange(angle, min, max) { return min < max - ? angle > min && angle < max - : angle > min && angle <= 180 || angle >= -180 && angle < max; + ? angle > min && angle < max + : angle > min || angle < max; } var v2 = c2.getTangentAtTime(t1Inside ? t1 : tMin), diff --git a/dist/docs/classes/Curve.html b/dist/docs/classes/Curve.html index fde953b7..0e9e7fbd 100644 --- a/dist/docs/classes/Curve.html +++ b/dist/docs/classes/Curve.html @@ -1470,6 +1470,44 @@ + + + + + +