Shorten Segment#_changed().

This commit is contained in:
Jürg Lehni 2011-05-26 11:04:57 +01:00
parent 5b6bc1263c
commit d8fbca0d68

View file

@ -85,25 +85,23 @@ var Segment = this.Segment = Base.extend({
}, },
_changed: function(point) { _changed: function(point) {
if (this._path) { if (!this._path)
// Delegate changes to affected curves if they exist return;
if (this._path._curves) { // Delegate changes to affected curves if they exist
var curve = this.getCurve(), other; var curve = this._path._curves && this.getCurve(), other;
if (curve) { if (curve) {
curve._changed(); curve._changed();
// Get the other affected curve, which is the previous one // Get the other affected curve, which is the previous one for
// for _point or _handleIn changing when this segment is // _point or _handleIn changing when this segment is _segment1 of
// _segment1 of the curve, for all other cases it's the next // the curve, for all other cases it's the next (e.g. _handleOut
// (e.g. _handleOut or this segment == _segment2) // when this segment is _segment2)
if (other = (curve[point == this._point if (other = (curve[point == this._point
|| point == this._handleIn && curve._segment1 == this || point == this._handleIn && curve._segment1 == this
? 'getPrevious' : 'getNext']())) { ? 'getPrevious' : 'getNext']())) {
other._changed(); other._changed();
}
}
} }
this._path._changed(ChangeFlags.GEOMETRY);
} }
this._path._changed(ChangeFlags.GEOMETRY);
}, },
/** /**