mirror of
https://github.com/konvajs/konva.git
synced 2025-10-08 00:14:23 +08:00
fixed bug related to multiple removals of same node
This commit is contained in:
27
dist/kinetic-core.js
vendored
27
dist/kinetic-core.js
vendored
@@ -960,12 +960,15 @@ Kinetic.Container.prototype = {
|
||||
* @param {Node} child
|
||||
*/
|
||||
_remove: function(child) {
|
||||
if(child.name !== undefined) {
|
||||
this.childrenNames[child.name] = undefined;
|
||||
if(this.children[child.index].id == child.id) {
|
||||
if(child.name !== undefined) {
|
||||
this.childrenNames[child.name] = undefined;
|
||||
}
|
||||
|
||||
this.children.splice(child.index, 1);
|
||||
this._setChildrenIndices();
|
||||
child = undefined;
|
||||
}
|
||||
this.children.splice(child.index, 1);
|
||||
this._setChildrenIndices();
|
||||
child = undefined;
|
||||
},
|
||||
/**
|
||||
* draw children
|
||||
@@ -1193,8 +1196,7 @@ Kinetic.Stage.prototype = {
|
||||
// then revert to previous no-parameter image/png behavior
|
||||
callback(bufferLayer.getCanvas().toDataURL(mimeType, quality));
|
||||
}
|
||||
catch(exception)
|
||||
{
|
||||
catch(exception) {
|
||||
callback(bufferLayer.getCanvas().toDataURL());
|
||||
}
|
||||
}
|
||||
@@ -1210,8 +1212,15 @@ Kinetic.Stage.prototype = {
|
||||
* @param {Layer} layer
|
||||
*/
|
||||
remove: function(layer) {
|
||||
// remove layer canvas from dom
|
||||
this.content.removeChild(layer.canvas);
|
||||
/*
|
||||
* remove canvas DOM from the document if
|
||||
* it exists
|
||||
*/
|
||||
try {
|
||||
this.content.removeChild(layer.canvas);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
this._remove(layer);
|
||||
},
|
||||
/**
|
||||
|
2
dist/kinetic-core.min.js
vendored
2
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user