Skip to content

Commit 59be244

Browse files
committed
DVF-2737 advanced Path serialization
1 parent 7276f22 commit 59be244

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/vector/PathBase.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,23 @@ acgraph.vector.PathBase.boundsCalculationMap_ = (function() {
10451045
// Serialize
10461046
//
10471047
//----------------------------------------------------------------------------------------------------------------------
1048+
/**
1049+
* Serialize only path arguments. For copy path data purposes.
1050+
* @param {Object=} opt_data .
1051+
* @return {Object}
1052+
*/
1053+
acgraph.vector.PathBase.prototype.serializePathArgs = function(opt_data) {
1054+
var data = opt_data || {};
1055+
data['closePoint'] = this.closePoint_ ? this.closePoint_.slice() : [];
1056+
data['currentPoint'] = this.currentPoint_ ? this.currentPoint_.slice() : [];
1057+
data['segments'] = this.segments_.slice();
1058+
data['count'] = this.count_.slice();
1059+
data['arguments'] = this.arguments_.slice();
1060+
1061+
return data;
1062+
};
1063+
1064+
10481065
/** @inheritDoc */
10491066
acgraph.vector.PathBase.prototype.deserialize = function(data) {
10501067
this.closePoint_ = data['closePoint'];
@@ -1061,11 +1078,7 @@ acgraph.vector.PathBase.prototype.deserialize = function(data) {
10611078
acgraph.vector.PathBase.prototype.serialize = function() {
10621079
var data = goog.base(this, 'serialize');
10631080
data['type'] = 'path';
1064-
data['closePoint'] = this.closePoint_ ? this.closePoint_.slice() : [];
1065-
data['currentPoint'] = this.currentPoint_ ? this.currentPoint_.slice() : [];
1066-
data['segments'] = this.segments_.slice();
1067-
data['count'] = this.count_.slice();
1068-
data['arguments'] = this.arguments_.slice();
1081+
data = this.serializePathArgs(data);
10691082
return data;
10701083
};
10711084

0 commit comments

Comments
 (0)