Fix nested dragging bug. close #71

This commit is contained in:
Anton Lavrenov
2019-08-12 08:42:50 +07:00
parent 15f5287b34
commit 04968c3b51
5 changed files with 61 additions and 7 deletions

View File

@@ -1486,7 +1486,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
return this.parent;
}
/**
* get all ancestros (parent then parent of the parent, etc) of the node
* get all ancestors (parent then parent of the parent, etc) of the node
* @method
* @name Konva.Node#findAncestors
* @param {String} [selector] selector for search
@@ -2334,7 +2334,17 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
if (this.isDragging()) {
return;
}
this.startDrag(evt);
var hasDraggingChild = false;
DD._dragElements.forEach(elem => {
if (this.isAncestorOf(elem.node)) {
hasDraggingChild = true;
}
})
if (!hasDraggingChild) {
this.startDrag(evt);
}
});
}