EasyDragging - Simple Smooth Gui Dragging Module

Introducing Easy Dragging (v0.0.1)

Get v0.0.1

Find other versions under here

Hey Devs!
I have recently come to notice that there aren’t any simple smooth dragging modules out there, so I have created this. Easy Dragging provides you with a simple yet satisfying way to add a dragging function to your UI objects.

Showcase (Dragspeed set to 8):

How do I start?

When you have imported the module, you can start by creating a new dragger in a Localscript or a Script with it’s RunContext property set to Client. Start with this code:

local EasyDragging = require(path.to.easydragging.module) -- Loads the module

local Dragger = EasyDragging.new(YOUR_DESIRED_SPEED) -- Creates a new Dragger

Now that you have successfully created a dragger, add a Gui object to this like this:

Dragger:AddObject(path.to.your.ui.object) -- Adds a Gui Object to your Dragger

Now your Gui object should be able to be dragged around.

Removing a Gui object

You can remove a Gui object from the Dragger by simply calling this function:

Dragger:RemoveObject(path.to.your.ui.object) -- Removes a Gui Object from your Dragger

Removing a Dragger

To destroy a dragger, call this function (WARNING: Destroying a dragger is not the same as removing an object, one simply removes the Gui object from the dragger, and one destroys the whole dragger disabling further use):

Dragger:Destroy() -- Removes your Dragger completely

Manually Updating a Dragger

If you want to update your dragger on something else than a drag, you can call the function below (Keep in mind that for this a delta time is required):

Dragger:Update(YOUR_DELTA_TIME) -- Updates your Dragger manually

That’s it for now. If there is any confusing or any bugs occur, feel free to comment on this post.
Feedback is also appreciated!

Happy Coding!

5 Likes

Boy do I have some news for you

I mainly created EasyDragging for making smooth dragging possible, but you’re right probably should have elaborated on that. (I do not know if the upcoming UI dragdetectors have that yet)

v0.0.2

Pre-Release

Get

Added Functions:

SetBound

Dragger:SetBound(path.to.your.gui.object, "YOUR_PREFERRED_AXIS") -- Changes the dragger to explicitly only move on the chosen axis, either X or Y

Known Issues:

  • Instantly stopping on letting go the gui object

Changed:

  • Made dragging more smooth

You could implement the new UIDragDetectors to your module

Hmm. If I add support for the UIDragDetectors, which features would you like to see? Should it just be the standard properties that of the DragDetector that affect the dragging as well as the module?

it will be in beta for some time (up to an year) so you’re fine i suppose

they’re actually planning on releasing it to live servers in the next few weeks

1 Like

oh so that’s cool, thank you for clarification!
i didn’t check much, my fault