From 03b947d3643498fd0f74462c4772ceef08ce9f75 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 17 Jan 2024 20:31:40 +0900 Subject: [PATCH] Ensure a finish event fires when fingers have just been placed and removed --- example/src/controls/TileControls.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/example/src/controls/TileControls.js b/example/src/controls/TileControls.js index 649246301..9fd76c87f 100644 --- a/example/src/controls/TileControls.js +++ b/example/src/controls/TileControls.js @@ -14,6 +14,7 @@ export const NONE = 0; export const DRAG = 1; export const ROTATE = 2; export const ZOOM = 3; +export const WAITING = 4; const DRAG_PLANE_THRESHOLD = 0.05; const DRAG_UP_THRESHOLD = 0.025; @@ -244,6 +245,7 @@ export class TileControls { if ( this.state === DRAG ) { this._updatePosition(); + // this.setState( NONE, WAITING, false ); } @@ -264,7 +266,8 @@ export class TileControls { const previousDist = pointerTracker.getPreviousPointerDistance(); const pointerDist = pointerTracker.getPointerDistance(); const separateDelta = pointerDist - previousDist; - if ( pinchAction === NONE ) { + + if ( this.pinchState === NONE || this.pinchState === WAITING ) { // check which direction was moved in first - if the pointers are pinching then // it's a zoom. But if they move in parallel it's a rotation