diff --git a/examples/JSON/Selection.html b/examples/JSON/Selection.html new file mode 100644 index 00000000..733d34cd --- /dev/null +++ b/examples/JSON/Selection.html @@ -0,0 +1,42 @@ + + + + + Symbols + + + + + + + + + + \ No newline at end of file diff --git a/src/basic/Point.js b/src/basic/Point.js index 1d2b6d22..60fae774 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -234,8 +234,7 @@ var Point = Base.extend(/** @lends Point# */{ var f = options.formatter; // For speed reasons, we directly call formatter.number() here, instead // of converting array through Base.serialize() which makes a copy. - return [f.number(this.x), - f.number(this.y)]; + return [f.number(this.x), f.number(this.y)]; }, /** diff --git a/src/item/Item.js b/src/item/Item.js index 84b386da..a1573af2 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -57,6 +57,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ blendMode: 'normal', opacity: 1, guide: false, + selected: false, clipMask: false, data: {} }, diff --git a/src/path/SegmentPoint.js b/src/path/SegmentPoint.js index 9dfd64e2..c8ae6b01 100644 --- a/src/path/SegmentPoint.js +++ b/src/path/SegmentPoint.js @@ -24,6 +24,7 @@ var SegmentPoint = Point.extend({ x = y = 0; } else if ((x = point[0]) !== undefined) { // Array-like y = point[1]; + selected = point[2]; // See #_serialize() } else { // If not Point-like already, read Point from arguments if ((x = point.x) === undefined) { @@ -47,6 +48,15 @@ var SegmentPoint = Point.extend({ return this; }, + _serialize: function(options) { + var f = options.formatter, + values = [f.number(this._x), f.number(this._y)]; + // Included the selected state of the segment point + if (this.isSelected()) + values.push(true); + return values; + }, + getX: function() { return this._x; },