mirror of
https://github.com/konvajs/konva.git
synced 2025-12-17 09:54:56 +08:00
black list for clone function. fix #583
This commit is contained in:
11
src/Node.js
11
src/Node.js
@@ -22,6 +22,7 @@
|
||||
TRANSFORM = 'transform',
|
||||
UPPER_STAGE = 'Stage',
|
||||
VISIBLE = 'visible',
|
||||
CLONE_BLACK_LIST = ['id'],
|
||||
|
||||
TRANSFORM_CHANGE_STR = [
|
||||
'xChange.kinetic',
|
||||
@@ -36,6 +37,7 @@
|
||||
'transformsEnabledChange.kinetic'
|
||||
].join(SPACE);
|
||||
|
||||
|
||||
Kinetic.Util.addMethods(Kinetic.Node, {
|
||||
_init: function(config) {
|
||||
var that = this;
|
||||
@@ -1181,9 +1183,14 @@
|
||||
clone: function(obj) {
|
||||
// instantiate new node
|
||||
var className = this.getClassName(),
|
||||
node = new Kinetic[className](this.attrs),
|
||||
attrs = this.attrs,
|
||||
key, allListeners, len, n, listener;
|
||||
|
||||
// filter black attrs
|
||||
for (var i in CLONE_BLACK_LIST) {
|
||||
var blockAttr = CLONE_BLACK_LIST[i];
|
||||
delete attrs[blockAttr];
|
||||
}
|
||||
var node = new Kinetic[className](attrs);
|
||||
// copy over listeners
|
||||
for(key in this.eventListeners) {
|
||||
allListeners = this.eventListeners[key];
|
||||
|
||||
Reference in New Issue
Block a user