Fix wrong double tap trigger

This commit is contained in:
Anton Lavrenov
2019-07-18 07:55:22 +07:00
parent 494666d070
commit 9cef088d24
6 changed files with 85 additions and 11 deletions

View File

@@ -565,7 +565,7 @@ export class Stage extends Container<BaseLayer> {
) {
shape._fireAndBubble(CLICK, { evt: evt });
if (fireDblClick && clickEndShape && clickEndShape._id === shape._id) {
if (fireDblClick && clickEndShape && clickEndShape === shape) {
shape._fireAndBubble(DBL_CLICK, { evt: evt });
}
}
@@ -642,6 +642,7 @@ export class Stage extends Container<BaseLayer> {
_touchend(evt) {
this.setPointersPositions(evt);
var shape = this.getIntersection(this.getPointerPosition()),
clickEndShape = this.clickEndShape,
fireDblClick = false;
if (Konva.inDblClickWindow) {
@@ -658,6 +659,7 @@ export class Stage extends Container<BaseLayer> {
}, Konva.dblClickWindow);
if (shape && shape.isListening()) {
this.clickEndShape = shape;
shape._fireAndBubble(TOUCHEND, { evt: evt });
// detect if tap or double tap occurred
@@ -668,7 +670,7 @@ export class Stage extends Container<BaseLayer> {
) {
shape._fireAndBubble(TAP, { evt: evt });
if (fireDblClick) {
if (fireDblClick && clickEndShape && clickEndShape === shape) {
shape._fireAndBubble(DBL_TAP, { evt: evt });
}
}