diff --git a/src/path/Curve.js b/src/path/Curve.js index 3e7b131e..a71ac6ac 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -2113,8 +2113,8 @@ new function() { // Scope for intersection using bezier fat-line clipping i2 = i1 ^ 1, // 1, 0, 1, 0 t1 = i >> 1, // 0, 0, 1, 1 t2 = Curve.getTimeOf(v[i1], new Point( - v[i2][t1 === 0 ? 0 : 6], - v[i2][t1 === 0 ? 1 : 7])); + v[i2][t1 ? 6 : 0], + v[i2][t1 ? 7 : 1])); if (t2 != null) { // If point is on curve var pair = i1 ? [t1, t2] : [t2, t1]; // Filter out tiny overlaps. diff --git a/src/path/CurveLocation.js b/src/path/CurveLocation.js index a475bf7d..7deadf96 100644 --- a/src/path/CurveLocation.js +++ b/src/path/CurveLocation.js @@ -292,11 +292,9 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{ divide: function() { var curve = this.getCurve(), res = null; - if (curve) { - res = curve.divideAtTime(this.getTime()); - // Change to the newly inserted segment, also adjusting _time. - if (res) - this._setSegment(res._segment1); + // Change to the newly inserted segment, also adjusts _time. + if (curve && (res = curve.divideAtTime(this.getTime()))) { + this._setSegment(res._segment1); } return res; }, diff --git a/src/path/Path.js b/src/path/Path.js index b063abbd..9f7a61e9 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -974,13 +974,10 @@ var Path = PathItem.extend(/** @lends Path# */{ */ divideAt: function(location) { var loc = this.getLocationAt(location), - ret = null; - if (loc) { - var curve = loc.getCurve().divideAt(loc.getCurveOffset()); - if (curve) - ret = curve._segment1; - } - return ret; + curve; + return loc && (curve = loc.getCurve().divideAt(loc.getCurveOffset())) + ? curve._segment1 + : null; }, /**