As a Roblox developer, it is currently too hard to cancel an in-progress UIDragDetector drag. There is no way to do this currently that doesn’t then break the UI (see UIDragDetector Breaks All UI).
If Roblox is able to address this issue, it would improve my development experience because the UIDragDetectors are a really powerful way to capture 2D input, but currently are not programmable enough for my use-case. I would ideally just want a UIDragDetector:Cancel()
method.
Use case
I have a system I’m building where I want the user on a computer or on mobile to drag an item up the screen past a certain point, using the speed and trajectory of this drag to form a really rich input experience for launching a physical item. I don’t want to use 3D drag detectors for this at the moment.
The need to cancel comes about because if the user takes a crazy path or drags too slowly, the launch is rejected and I want to cancel and reset the dragger back to the original position.
Here’s a video and repro to illustrate the mechanic quite simply (and demonstrate the existing bug with the only current way to cancel a drag). When the dragged object goes beyond the pink line, I want the ability to programmatically cancel it:
DragDetectorBug.rbxl (61.8 KB)
3D drag detectors
It’s worth noting that the 3D DragDetector instance is also missing a straightforward way to cancel a drag, however in that case, the Enabled = false
then Enabled = true
workaround does produce the desired behaviour and doesn’t break anything.
It may be most consistent to add a Cancel
method to both types of drag detector.