mirror of
https://github.com/konvajs/konva.git
synced 2025-11-18 17:21:36 +08:00
Deep cloning. Cloning also clones children. Also added unit test to confirm that it's working as expected.
This commit is contained in:
18
dist/kinetic-core.js
vendored
18
dist/kinetic-core.js
vendored
@@ -3,7 +3,7 @@
|
||||
* http://www.kineticjs.com/
|
||||
* Copyright 2012, Eric Rowell
|
||||
* Licensed under the MIT or GPL Version 2 licenses.
|
||||
* Date: Aug 26 2012
|
||||
* Date: Sep 02 2012
|
||||
*
|
||||
* Copyright (C) 2011 - 2012 by Eric Rowell
|
||||
*
|
||||
@@ -2605,6 +2605,22 @@ Kinetic.Container.prototype = {
|
||||
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* clone node
|
||||
* @name clone
|
||||
* @methodOf Kinetic.Node.prototype
|
||||
* @param {Object} attrs override attrs
|
||||
*/
|
||||
clone: function(obj) {
|
||||
// call super method
|
||||
var node = Kinetic.Node.prototype.clone.call(this, obj)
|
||||
|
||||
// perform deep clone on containers
|
||||
for(var key in this.children) {
|
||||
node.add(this.children[key].clone());
|
||||
}
|
||||
return node;
|
||||
},
|
||||
/**
|
||||
* get shapes that intersect a point
|
||||
* @name getIntersections
|
||||
|
||||
6
dist/kinetic-core.min.js
vendored
6
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user