stop triggering click and tap on short drag&drop. fix #784

This commit is contained in:
Anton Lavrenov
2019-11-12 15:10:36 -05:00
parent 680ea026d8
commit 67d5e362e8
6 changed files with 1444 additions and 58 deletions

View File

@@ -109,7 +109,8 @@ export const DD = {
return;
}
if (elem.dragStatus === 'dragging') {
if (elem.dragStatus === 'dragging' || elem.dragStatus === 'stopped') {
// if a node is stopped manully we still need to reset events:
DD.justDragged = true;
Konva.listenClickTap = false;
elem.dragStatus = 'stopped';

View File

@@ -546,6 +546,7 @@ export class Stage extends Container<BaseLayer> {
var pointerId = Util._getFirstPointerId(evt);
var shape = this.getIntersection(this.getPointerPosition());
DD.justDragged = false;
Konva.listenClickTap = true;
if (shape && shape.isListening()) {
@@ -590,8 +591,6 @@ export class Stage extends Container<BaseLayer> {
// don't set inDblClickWindow after dragging
Konva.inDblClickWindow = true;
clearTimeout(this.dblTimeout);
} else if (DD) {
DD.justDragged = false;
}
this.dblTimeout = setTimeout(function() {
@@ -677,6 +676,7 @@ export class Stage extends Container<BaseLayer> {
this._changedPointerPositions.forEach(pos => {
var shape = this.getIntersection(pos);
Konva.listenClickTap = true;
DD.justDragged = false;
const hasShape = shape && shape.isListening();
if (!hasShape) {