mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Introduce private Item#_clone(copy), so subclasses can override the way the copy is actually produced, e.g. providing parameters to the constructor.
This commit is contained in:
parent
fd8ceb9641
commit
87d340e525
1 changed files with 4 additions and 1 deletions
|
@ -30,7 +30,10 @@ var Item = this.Item = Base.extend({
|
||||||
* @return the newly cloned item
|
* @return the newly cloned item
|
||||||
*/
|
*/
|
||||||
clone: function() {
|
clone: function() {
|
||||||
var copy = new this.constructor();
|
return this._clone(new this.constructor());
|
||||||
|
},
|
||||||
|
|
||||||
|
_clone: function(copy) {
|
||||||
// Copy over style
|
// Copy over style
|
||||||
copy.setStyle(this._style);
|
copy.setStyle(this._style);
|
||||||
// If this item has children, clone and append each of them:
|
// If this item has children, clone and append each of them:
|
||||||
|
|
Loading…
Reference in a new issue