diff --git a/src/path/Curve.js b/src/path/Curve.js index 221c9292..c0bc9139 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -525,7 +525,8 @@ var Curve = Base.extend(/** @lends Curve# */{ * @see Path#splitAt(offset) */ splitAt: function(location) { - return this._path ? this._path.splitAt(location) : null; + var path = this._path; + return path ? path.splitAt(location) : null; }, /** @@ -538,8 +539,8 @@ var Curve = Base.extend(/** @lends Curve# */{ * @return {Path} the newly created path after splitting, if any * @see Path#splitAt(offset) */ - splitAtTime: function(t) { - return this.splitAt(this.getLocationAtTime(t)); + splitAtTime: function(time) { + return this.splitAt(this.getLocationAtTime(time)); }, // TODO: Remove in 1.0.0? (deprecated January 2016): diff --git a/src/path/CurveLocation.js b/src/path/CurveLocation.js index 9fe7af31..4f7ad57c 100644 --- a/src/path/CurveLocation.js +++ b/src/path/CurveLocation.js @@ -289,17 +289,23 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{ divide: function() { var curve = this.getCurve(), - res = null; + res = curve && curve.divideAtTime(this.getTime()); // Change to the newly inserted segment, also adjusts _time. - if (curve && (res = curve.divideAtTime(this.getTime()))) { + if (res) { this._setSegment(res._segment1); } return res; }, split: function() { - var curve = this.getCurve(); - return curve ? curve.splitAtTime(this.getTime()) : null; + var curve = this.getCurve(), + path = curve._path, + res = curve && curve.splitAtTime(this.getTime()); + if (res) { + // Set the segment to the end-segment of the path after splitting. + this._setSegment(path.getLastSegment()); + } + return res; }, /**