DragDetector

Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.

Up and coming

Drag things 1:1 with the pointer and throw them, report drags for splitters and sliders, or drag and drop between targets.

Put it under a UIObject: pressing that object and moving past Threshold starts a drag, so a click stays a click. Mode picks Move (the parent follows the pointer), Report (events only) or DragDrop (a ghost of the parent follows and each DropTarget lights up). The 1:1 follow and the throw happen without a round trip through your script on every mouse move.

Made with Instance.new("DragDetector") or Clone().

Properties

NameTypeDefaultDescription
Enabledboolean
Mode"Move" | "Report" | "DragDrop"Move: the parent follows the pointer 1:1; Report: events only, for splitters and sliders; DragDrop: a ghost of the parent follows and DropTargets light up.
Axis"XY" | "X" | "Y"
ThrowbooleanMove only: on release the parent keeps its speed and glides to a stop; any new press cancels the glide.
ThresholdnumberHow far the pointer moves before a drag starts, 4 pixels by default, so a click stays a click.
TagstringWhat DropTargets match against their Accepts list.
DataanyWhat a DropTarget receives when this is dropped on it.
Draggingbooleanread-only

Events

NamePassesDescription
DragStarted(Vector2)Fires once the pointer has moved past Threshold, passing the position.
DragMoved(Vector2, Vector2)Passes the pointer's position and the delta.
DragEnded(Vector2)Fires on release, passing the velocity, not a position.
From ShotInstance 33