fix rare error throws

This commit is contained in:
Anton Lavrenov
2017-08-26 13:12:01 +02:00
parent 13a21e0e0a
commit 052f296149
4 changed files with 16 additions and 5 deletions

View File

@@ -18,10 +18,15 @@
// methods
_drag: function(evt) {
var dd = Konva.DD, node = dd.node;
if (node) {
if (!dd.isDragging) {
var pos = node.getStage().getPointerPosition();
// it is possible that pos is undefined
// reattach it
if (!pos) {
node.getStage()._setPointerPosition(evt);
pos = node.getStage().getPointerPosition();
}
var dragDistance = node.dragDistance();
var distance = Math.max(
Math.abs(pos.x - dd.startPointerPos.x),