From 54c8beef4e827c46ed68dabc364eea0851d75662 Mon Sep 17 00:00:00 2001 From: Thomas Chandelle Date: Wed, 1 Feb 2017 13:32:02 +0100 Subject: [PATCH 1/3] Stop handling down/up sequence when all fingers have been removed --- src/ol/interaction/pointer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ol/interaction/pointer.js b/src/ol/interaction/pointer.js index 048ff27bf9..b96193f735 100644 --- a/src/ol/interaction/pointer.js +++ b/src/ol/interaction/pointer.js @@ -187,8 +187,8 @@ ol.interaction.Pointer.handleEvent = function(mapBrowserEvent) { if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERDRAG) { this.handleDragEvent_(mapBrowserEvent); } else if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERUP) { - this.handleUpEvent_(mapBrowserEvent); - this.handlingDownUpSequence = false; + this.handlingDownUpSequence = this.handleUpEvent_(mapBrowserEvent) && + this.targetPointers.length > 0; } } else { if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERDOWN) { From 14222e68e79f2d1fdead6a9f095680850032d095 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 3 Feb 2017 14:09:15 -0700 Subject: [PATCH 2/3] Removing side effects from logical expression --- src/ol/interaction/pointer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ol/interaction/pointer.js b/src/ol/interaction/pointer.js index b96193f735..f61e76ffe6 100644 --- a/src/ol/interaction/pointer.js +++ b/src/ol/interaction/pointer.js @@ -187,8 +187,8 @@ ol.interaction.Pointer.handleEvent = function(mapBrowserEvent) { if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERDRAG) { this.handleDragEvent_(mapBrowserEvent); } else if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERUP) { - this.handlingDownUpSequence = this.handleUpEvent_(mapBrowserEvent) && - this.targetPointers.length > 0; + var handledUp = this.handleUpEvent_(mapBrowserEvent); + this.handlingDownUpSequence = handledUp && this.targetPointers.length > 0; } } else { if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERDOWN) { From 67e2d0204612628c65db599b383f17b3adcbd2c8 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 3 Feb 2017 14:09:39 -0700 Subject: [PATCH 3/3] Resetting kinetic after one pointer up --- src/ol/interaction/dragpan.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ol/interaction/dragpan.js b/src/ol/interaction/dragpan.js index 30cb906f07..f499174da0 100644 --- a/src/ol/interaction/dragpan.js +++ b/src/ol/interaction/dragpan.js @@ -112,6 +112,11 @@ ol.interaction.DragPan.handleUpEvent_ = function(mapBrowserEvent) { view.setHint(ol.ViewHint.INTERACTING, -1); return false; } else { + if (this.kinetic_) { + // reset so we don't overestimate the kinetic energy after + // after one finger up, tiny drag, second finger up + this.kinetic_.begin(); + } this.lastCentroid = null; return true; }