Some code cleanup.

This commit is contained in:
Jürg Lehni 2016-12-31 11:33:18 +01:00
parent f995216f39
commit 7651f41c14
3 changed files with 9 additions and 14 deletions

View file

@ -2113,8 +2113,8 @@ new function() { // Scope for intersection using bezier fat-line clipping
i2 = i1 ^ 1, // 1, 0, 1, 0 i2 = i1 ^ 1, // 1, 0, 1, 0
t1 = i >> 1, // 0, 0, 1, 1 t1 = i >> 1, // 0, 0, 1, 1
t2 = Curve.getTimeOf(v[i1], new Point( t2 = Curve.getTimeOf(v[i1], new Point(
v[i2][t1 === 0 ? 0 : 6], v[i2][t1 ? 6 : 0],
v[i2][t1 === 0 ? 1 : 7])); v[i2][t1 ? 7 : 1]));
if (t2 != null) { // If point is on curve if (t2 != null) { // If point is on curve
var pair = i1 ? [t1, t2] : [t2, t1]; var pair = i1 ? [t1, t2] : [t2, t1];
// Filter out tiny overlaps. // Filter out tiny overlaps.

View file

@ -292,11 +292,9 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
divide: function() { divide: function() {
var curve = this.getCurve(), var curve = this.getCurve(),
res = null; res = null;
if (curve) { // Change to the newly inserted segment, also adjusts _time.
res = curve.divideAtTime(this.getTime()); if (curve && (res = curve.divideAtTime(this.getTime()))) {
// Change to the newly inserted segment, also adjusting _time. this._setSegment(res._segment1);
if (res)
this._setSegment(res._segment1);
} }
return res; return res;
}, },

View file

@ -974,13 +974,10 @@ var Path = PathItem.extend(/** @lends Path# */{
*/ */
divideAt: function(location) { divideAt: function(location) {
var loc = this.getLocationAt(location), var loc = this.getLocationAt(location),
ret = null; curve;
if (loc) { return loc && (curve = loc.getCurve().divideAt(loc.getCurveOffset()))
var curve = loc.getCurve().divideAt(loc.getCurveOffset()); ? curve._segment1
if (curve) : null;
ret = curve._segment1;
}
return ret;
}, },
/** /**