diff --git a/examples/JSON/Selection.html b/examples/JSON/Selection.html index 733d34cd..9b3ae51b 100644 --- a/examples/JSON/Selection.html +++ b/examples/JSON/Selection.html @@ -25,6 +25,7 @@ to: [100, 225], fillColor: 'green' }); + rectangle.lastSegment.point.selected = true; var group = new Group(circle, rectangle); diff --git a/src/path/Segment.js b/src/path/Segment.js index 82622896..1b821a8e 100644 --- a/src/path/Segment.js +++ b/src/path/Segment.js @@ -117,7 +117,7 @@ var Segment = Base.extend(/** @lends Segment# */{ if (count === 0) { // Nothing } else if (count === 1) { - // Note: This copies from existing segments through bean getters + // Note: This copies from existing segments through accessors. if (arg0.point) { point = arg0.point; handleIn = arg0.handleIn; @@ -125,15 +125,17 @@ var Segment = Base.extend(/** @lends Segment# */{ } else { point = arg0; } - } else if (count === 2 && typeof arg0 === 'number') { - point = [ arg0, arg1 ]; + } else if ((count === 2 || count === 3) && typeof arg0 === 'number') { + // We check for 3 and 2 because there is an optional boolean + // argument for segment points to mark them as selected. + point = arguments; } else if (count <= 3) { point = arg0; // Doesn't matter if these arguments exist, SegmentPointcreate // produces creates points with (0, 0) otherwise handleIn = arg1; handleOut = arg2; - } else { + } else { // Read points from the arguments list as a row of numbers point = arg0 !== undefined ? [ arg0, arg1 ] : null; handleIn = arg2 !== undefined ? [ arg2, arg3 ] : null; handleOut = arg4 !== undefined ? [ arg4, arg5 ] : null;