mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22: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
|
||||
*/
|
||||
clone: function() {
|
||||
var copy = new this.constructor();
|
||||
return this._clone(new this.constructor());
|
||||
},
|
||||
|
||||
_clone: function(copy) {
|
||||
// Copy over style
|
||||
copy.setStyle(this._style);
|
||||
// If this item has children, clone and append each of them:
|
||||
|
|
Loading…
Reference in a new issue