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
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.

View file

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

View file

@ -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;
},
/**