mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Some code clean-up in Segment#_changed()
This commit is contained in:
parent
cc8b23894c
commit
2dce6c4efa
1 changed files with 8 additions and 6 deletions
|
@ -158,19 +158,21 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
// Delegate changes to affected curves if they exist.
|
// Delegate changes to affected curves if they exist.
|
||||||
var curves = path._curves,
|
var curves = path._curves,
|
||||||
index = this._index,
|
index = this._index,
|
||||||
curveIn, curveOut;
|
curve;
|
||||||
if (curves) {
|
if (curves) {
|
||||||
// Updated the neighboring affected curves, depending on which point
|
// Updated the neighboring affected curves, depending on which point
|
||||||
// is changing.
|
// is changing.
|
||||||
// TODO: Consider exposing these curves too, through #curveIn,
|
// TODO: Consider exposing these curves too, through #curveIn,
|
||||||
// and #curveOut, next to #curve?
|
// and #curveOut, next to #curve?
|
||||||
if ((!point || point === this._point || point === this._handleIn)
|
if ((!point || point === this._point || point === this._handleIn)
|
||||||
&& (curveIn = curves[index - 1]
|
&& (curve = index > 0 ? curves[index - 1] : path._closed
|
||||||
|| path._closed && curves[curves.length - 1]))
|
? curves[curves.length - 1] : null))
|
||||||
curveIn._changed();
|
curve._changed();
|
||||||
|
// No wrap around needed for outgoing curve, as only closed paths
|
||||||
|
// will have one for the last segment.
|
||||||
if ((!point || point === this._point || point === this._handleOut)
|
if ((!point || point === this._point || point === this._handleOut)
|
||||||
&& (curveOut = curves[index]))
|
&& (curve = curves[index]))
|
||||||
curveOut._changed();
|
curve._changed();
|
||||||
}
|
}
|
||||||
path._changed(/*#=*/Change.SEGMENTS);
|
path._changed(/*#=*/Change.SEGMENTS);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue