mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 23:04:49 +00:00
Increase hold delay to 750ms and use Euclidean distance for cancellation
Use total distance (diagonal-aware) instead of per-axis thresholds to better detect scrolling gestures that travel diagonally. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -113,11 +113,12 @@ export default class extends Controller {
|
||||
const touchX = event.touches[0].clientX;
|
||||
const touchY = event.touches[0].clientY;
|
||||
|
||||
// If hold hasn't activated yet, cancel it if user moves too far (they're scrolling)
|
||||
// If hold hasn't activated yet, cancel if user moves too far (scrolling or swiping)
|
||||
// Uses Euclidean distance to catch diagonal gestures too
|
||||
if (!this.holdActivated) {
|
||||
const dx = touchX - this.touchStartX;
|
||||
const dy = touchY - this.touchStartY;
|
||||
if (Math.abs(dx) > 10 || Math.abs(dy) > 10) {
|
||||
if (dx * dx + dy * dy > 100) { // 10px radius
|
||||
this.cancelHold();
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user