From 2dce6c4efaae5b06675e0aaf9f88a1a99f602ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 27 Sep 2014 22:09:25 +0200 Subject: [PATCH] Some code clean-up in Segment#_changed() --- src/path/Segment.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/path/Segment.js b/src/path/Segment.js index cd76ccd4..d98defe8 100644 --- a/src/path/Segment.js +++ b/src/path/Segment.js @@ -158,19 +158,21 @@ var Segment = Base.extend(/** @lends Segment# */{ // Delegate changes to affected curves if they exist. var curves = path._curves, index = this._index, - curveIn, curveOut; + curve; if (curves) { // Updated the neighboring affected curves, depending on which point // is changing. // TODO: Consider exposing these curves too, through #curveIn, // and #curveOut, next to #curve? if ((!point || point === this._point || point === this._handleIn) - && (curveIn = curves[index - 1] - || path._closed && curves[curves.length - 1])) - curveIn._changed(); + && (curve = index > 0 ? curves[index - 1] : path._closed + ? curves[curves.length - 1] : null)) + 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) - && (curveOut = curves[index])) - curveOut._changed(); + && (curve = curves[index])) + curve._changed(); } path._changed(/*#=*/Change.SEGMENTS); },