The personal finance app for everyone (by everyone)
Ruby
Increase hold delay to 750ms and use Euclidean distance for cancellation
juan31a5ac156b5b
diff --git a/app/javascript/controllers/dashboard_sortable_controller.js b/app/javascript/controllers/dashboard_sortable_controller.jsindex dfaa1e1c76..06731b8589 100644--- a/app/javascript/controllers/dashboard_sortable_controller.js+++ b/app/javascript/controllers/dashboard_sortable_controller.js@@ -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 tooif (!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 radiusthis.cancelHold();}return;