From 7e654261588b0323ce98694125539b3719c3afde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 28 Nov 2013 22:27:14 +0100 Subject: [PATCH] Implement Item#data cloning. Closes #340. --- src/item/Item.js | 2 ++ src/style/Color.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/item/Item.js b/src/item/Item.js index 13e592a2..0e114330 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1313,6 +1313,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{ } // Use Matrix#initialize to easily copy over values. copy._matrix.initialize(this._matrix); + // Copy over _data as well. + copy._data = this._data ? Base.clone(this._data) : null; // Copy over the selection state, use setSelected so the item // is also added to Project#selectedItems if it is selected. copy.setSelected(this._selected); diff --git a/src/style/Color.js b/src/style/Color.js index dad81c1b..d2f59f5e 100644 --- a/src/style/Color.js +++ b/src/style/Color.js @@ -760,6 +760,8 @@ var Color = Base.extend(new function() { * * @return {Color} a copy of the color object */ + // NOTE: There is no need to actually implement this, since it's the + // same as Base#clone() /** * {@grouptitle String Representations}