From 92953cfb4aa4027b2bed07b0d79a8504c66b787a Mon Sep 17 00:00:00 2001 From: Riyadh Date: Thu, 21 May 2026 07:07:31 +0000 Subject: [PATCH] Improve drag and drop interactions by adjusting activation constraints Adjusts drag activation constraints for pointer and touch sensors, enabling instant drag initiation in edit mode with a lower activation distance and no delay, while maintaining a higher threshold and delay outside of edit mode. --- artifacts/tx-os/src/pages/services.tsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/artifacts/tx-os/src/pages/services.tsx b/artifacts/tx-os/src/pages/services.tsx index 53b3135e..9fadf5a3 100644 --- a/artifacts/tx-os/src/pages/services.tsx +++ b/artifacts/tx-os/src/pages/services.tsx @@ -254,13 +254,23 @@ export default function ServicesPage() { return rows; }, [services, orderedIds]); - // Touch sensor uses delay so a tap-to-open isn't misread as a drag; - // pointer sensor needs only the tiny activation distance so mouse - // drags feel responsive on the desktop preview. + // Drag activation is tuned per-mode: + // * Outside edit mode we never want a drag (cards are only tappable + // to place an order), so a slightly higher distance threshold + // keeps the long-press-to-enter-edit gesture clean. + // * Inside edit mode the user has already opted into reordering, so + // drags should start instantly with no touch delay — matching the + // iOS home-screen "jiggle" feel. A tiny `distance: 2` activation + // still tolerates the natural finger jitter that happens before + // intentional movement, without making drags feel sluggish. const sensors = useSensors( - useSensor(PointerSensor, { activationConstraint: { distance: 6 } }), + useSensor(PointerSensor, { + activationConstraint: { distance: editMode ? 2 : 6 }, + }), useSensor(TouchSensor, { - activationConstraint: { delay: 150, tolerance: 8 }, + activationConstraint: editMode + ? { distance: 2 } + : { delay: 150, tolerance: 8 }, }), );