{"id":"coffilhg/greatuidrag","name":"greatuidrag","scope":"coffilhg","platform":"roblox","description":"Draggable UIs made easy!","version":"1.0.0","latest":"1.0.0","versions":["0.0.1","0.0.2","1.0.0"],"license":"MPL-2.0","licenseRating":"caution","licenseCaveats":["File-level copyleft: if you modify this package's own source files, those modified files must be made available under MPL-2.0. Using it unmodified in a closed-source game is fine."],"licenseVerified":true,"dependencies":{"coffilhg/coffeeobjects":{"version":"^2.4.0","alias":"CoffeeObjects"},"coffilhg/guicompatibility":{"version":"^1.0.0","alias":"GUICompatibility"}},"integrity":"1b353361d1564b8b60d6a63b2cff53203a946b6b42b9908f9adee56638ee62d5","likes":0,"downloads":0,"install":"forest install coffilhg/greatuidrag","url":"https://forest.dev/p/roblox/coffilhg/greatuidrag","files":"https://api.forest.dev/ai/package/roblox/coffilhg/greatuidrag/files","readme":"# GreatUIDrag\r\n\r\nDraggable UIs made easy!\r\nSupports desktop and mobile, GUI insets, anchor points, viewport resizing, and CSS-like padding limits. Console support is untested but should work for cursor-based input.\r\n\r\n\r\n\r\n## Available Here!\r\n- **[This repository](src/init.luau) ~ [src/init.luau](src/init.luau)**\r\n- **[Wally](<https://wally.run/package/coffilhg/greatuidrag>)**\r\n\r\n    ```toml\r\n    GreatUIDrag = \"coffilhg/greatuidrag@1.0.0\"\r\n    ```\r\n- **[Rotriever](<https://github.com/Coffilhg/Useful-Modules/releases/tag/vGreatUIDrag/1.0.0>)**\r\n\r\n    ```toml\r\n    GreatUIDrag = \"github.com/Coffilhg/Useful-Modules@GreatUIDrag/1.0.0\"\r\n    ```\r\n\r\n<!-- **[Creator Store](<https://create.roblox.com/store/category/gameplay?creatorName=coffilhg>)** ~ **[GreatUIDrag](<https://create.roblox.com/store/asset/123456789/GreatUIDrag>)**-->\r\n\r\n---\r\n\r\n## Features\r\n- Smooth spring interpolation (no Tween spam, thx to @crusherfire)\r\n- CSS-like padding\r\n- Optionally multiple drag handles\r\n- Sensibility, speed and damping control\r\n- Automatically handles\r\n    - IgnoreGuiInset changes\r\n    - AnchorPoint\r\n    - Viewport resizing (Non-fullscreen players and mobile players rotating their screen)\r\n\r\n---\r\n\r\n## Usage\r\n\r\nPlace the module and its dependencies somewhere accessible (e.g. `ReplicatedStorage`):\r\n```\r\nGreatUIDrag\r\n├── GUICompatibility\r\n├── CoffeeObjects\r\n└── _Spring\r\n```\r\n\r\nThen require it:\r\n```lua\r\nlocal GreatUIDrag = require(path.To.GreatUIDrag)\r\n```\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n```lua\r\nGreatUIDrag(\r\n    Frame,          -- GuiObject to move\r\n    Frame.Header    -- Drag handle (TextButton / ImageButton)\r\n)\r\n```\r\n\r\nor more explicit\r\n\r\n```lua\r\nlocal drag = GreatUIDrag(\r\n    Frame,                  -- GuiObject to move\r\n    Frame.Header,           -- Drag handle (TextButton / ImageButton)\r\n    1,                      -- Damping (Less = more like jelly)\r\n    27,                     -- Speed (More = faster interpolation)\r\n    {UDim.new(0.04, 8)},    -- Padding (Top, Right, Bottom, Left)\r\n    1                       -- Sensibility (Useful for UI bigger than screen)\r\n)\r\n```\r\n\r\n---\r\n\r\n## API\r\n\r\n```lua\r\nGreatUIDrag(\r\n    dragElement: GuiObject,\r\n    dragHandle: TextButton | ImageButton | {TextButton | ImageButton},\r\n    damping: number?,\r\n    speed: number?,\r\n    paddingOptions: {number | UDim}?,\r\n    sensibilityMultiplier: number?\r\n) -> DragElement\r\n```\r\n\r\n## Parameters\r\n\r\n### `dragElement`\r\n> The UI object that will move.\r\n\r\n### `dragHandle`\r\n> A `TextButton` or `ImageButton`\r\n> OR a table of them (must contain at least ONE `TextButton` or `ImageButton`)\r\n\r\n### `damping` (optional)\r\n> Spring damping factor\r\n> Default = `1`\r\n>\r\n> Lower = bouncier\r\n> Higher = stiffer\r\n\r\n### `speed` (optional)\r\n> Spring speed\r\n> Default = `27 / sensibilityMultiplier`\r\n\r\n### `paddingOptions` (optional)\r\n> CSS-like syntax:\r\n\r\n| Input                      | Result                                                                       |\r\n|----------------------------|------------------------------------------------------------------------------|\r\n| Empty (`nil`) or `{}`      | Defaults to 30px padding on all sides                                        |\r\n| `{x}`                      | All sides have `x` padding                                                   |\r\n| `{y, x}`                   | Horizontal (top+bottom) padding is `y`; Vertical (right+left) padding is `x` |\r\n| `{y1, x, y2}`              | Top padding = `y1`, sides (right+left) padding = `x`, Bottom padding = `y2`  |\r\n| `top, right, bottom, left` | full control                                                                 |\r\n\r\n> Each value can be an UDim or a number, which will be converted into UDim.new(0, number) (pixels)\r\n\r\n### `sensibilityMultiplier` (optional)\r\n> Drag sensitivity\r\n> Default = `1`\r\n\r\n## Returned Object (`DragElement`) Methods\r\n\r\n```lua\r\nlocal MyDragElement = GreatUIDrag(...)\r\n```\r\n\r\n### `MyDragElement:InitDrag()`\r\n> Activates dragging (as if client started using one of the drag handles), if this `DragElement` isn't active already\r\n\r\n### `MyDragElement:Reposition()`\r\n> Immediately repositions the element to the current spring state\r\n> (no arguments)\r\n\r\n### `MyDragElement:Stop()`\r\n> Stops active dragging (client input signals) but allows spring to reach the latest goal\r\n\r\n---\r\n\r\n## Notes\r\n- Only one active drag is allowed at a time (intentional)\r\n- Uses `RunService.Heartbeat` only while active or on-the-way to complete the latest goal\r\n- Automatically updates bounds based on:\r\n    - Viewport resize (`game.Workspace.CurrentCamera:GetPropertyChangedSignal(\"ViewportSize\")`)\r\n    - AnchorPoint change (`dragElement:GetPropertyChangedSignal(\"AnchorPoint\")`)\r\n    - GuiInset change (`GUICompatibility:GetGuiInsetSize().Value`)\r\n\r\n---\r\n\r\n## Dependencies\r\n- [GUICompatibility](https://github.com/Coffilhg/Useful-Modules/tree/GUICompatibility)\r\n- [CoffeeObjects](https://github.com/Coffilhg/Useful-Modules/tree/CoffeeObjects)\r\n- [_Spring](https://create.roblox.com/store/asset/71132874095126/Spring-Module) (by @crusherfire | https://www.roblox.com/users/80102935/profile)\r\n\r\n## License & Attribution\r\n\r\nThis module is licensed under the **Mozilla Public License 2.0 (MPL-2.0)**.\r\n\r\n#### What this means for Roblox Developers:\r\n* **Use & Modify:** You can freely use this module in any public, private, or commercial Roblox game.\r\n* **File-Level Copyleft:** If you modify the source code of this module itself, you must make your modified version of the module publicly available under the MPL 2.0.\r\n* **No Viral Code Leakage:** Including this module in your game does **not** force you to open-source your other game scripts, UI layouts, or proprietary codebase. \r\n\r\nSee the full terms in the [LICENSE](LICENSE) file.\r\n\r\nAttribution to all dependencies is included in [Notice](NOTICE)\r\n\r\nCopyright © 2026 @Coffilhg (Roblox UserId 517222346)","readmeTruncated":false}