From d8fbca0d684da5de1ee233f301931a8f01f5aacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 26 May 2011 11:04:57 +0100 Subject: [PATCH] Shorten Segment#_changed(). --- src/path/Segment.js | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/path/Segment.js b/src/path/Segment.js index 4e7d2d64..89b1c781 100644 --- a/src/path/Segment.js +++ b/src/path/Segment.js @@ -85,25 +85,23 @@ var Segment = this.Segment = Base.extend({ }, _changed: function(point) { - if (this._path) { - // Delegate changes to affected curves if they exist - if (this._path._curves) { - var curve = this.getCurve(), other; - if (curve) { - curve._changed(); - // Get the other affected curve, which is the previous one - // for _point or _handleIn changing when this segment is - // _segment1 of the curve, for all other cases it's the next - // (e.g. _handleOut or this segment == _segment2) - if (other = (curve[point == this._point - || point == this._handleIn && curve._segment1 == this - ? 'getPrevious' : 'getNext']())) { - other._changed(); - } - } + if (!this._path) + return; + // Delegate changes to affected curves if they exist + var curve = this._path._curves && this.getCurve(), other; + if (curve) { + curve._changed(); + // Get the other affected curve, which is the previous one for + // _point or _handleIn changing when this segment is _segment1 of + // the curve, for all other cases it's the next (e.g. _handleOut + // when this segment is _segment2) + if (other = (curve[point == this._point + || point == this._handleIn && curve._segment1 == this + ? 'getPrevious' : 'getNext']())) { + other._changed(); } - this._path._changed(ChangeFlags.GEOMETRY); } + this._path._changed(ChangeFlags.GEOMETRY); }, /**