mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Some code cleanup.
This commit is contained in:
parent
f995216f39
commit
7651f41c14
3 changed files with 9 additions and 14 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue