Merge pull request #11673 from ahocevar/no-multitouch-as-doubleclick

Do not emulate dblclick and slingleclick on multi-touch
This commit is contained in:
Andreas Hocevar
2020-10-22 11:00:38 +02:00
committed by GitHub
2 changed files with 108 additions and 13 deletions

View File

@@ -31,6 +31,12 @@ class MapBrowserEventHandler extends EventTarget {
*/
this.clickTimeoutId_;
/**
* Emulate dblclick and singleclick. Will be true when only one pointer is active.
* @type {boolean}
*/
this.emulateClicks_ = false;
/**
* @type {boolean}
* @private
@@ -197,6 +203,7 @@ class MapBrowserEventHandler extends EventTarget {
// We only fire click, singleclick, and doubleclick if nobody has called
// event.stopPropagation() or event.preventDefault().
if (
this.emulateClicks_ &&
!newEvent.propagationStopped &&
!this.dragging_ &&
this.isMouseActionButton_(pointerEvent)
@@ -228,6 +235,7 @@ class MapBrowserEventHandler extends EventTarget {
* @private
*/
handlePointerDown_(pointerEvent) {
this.emulateClicks_ = this.activePointers_ === 0;
this.updateActivePointers_(pointerEvent);
const newEvent = new MapBrowserEvent(
MapBrowserEventType.POINTERDOWN,