DX library that allows you to easily create scrollbar.
This is a simple library for create scrollbars which allows easy creation of some resources
You need download the file scrollbar.lua and put it in your project, but don't forget to load it in the meta.xml. Example of uses in the file example.lua
Create a new scrollbar using the methdo new, the method takes a table with the following properties: x, y, width, height, maxValue, minValue, orientation. The orientation can be "vertical" or "horizontal". And the optional arguments are (bgRadius, barRadius), bgRadius is the radius of the background and barRadius is the radius of the bar. Example of use:
local myScrollbar = Scrollbar:new({ x = 200, y = 200, width = 20, height = 200, maxValue = 100, minValue = 0, orientation = "vertical" })Now, for use the methods of the scrollbar, you need to use the variable myScrollbar
Render the scrollbar
myScrollbar:render()Change a property of scrollbar. Consulte the list of properties below to see what you can change and how to do it.
myScrollbar:setProperty(property, value)Set a new offset
myScrollbar:setScrollOffset(value)Get the current offset value
myScrollbar:onScroll(callback)The callback function takes the offset value as a parameter
Get the output the scroll offset
myScrollbar:onScrollEnd(callback)The callback function takes the offset value as a parameter
Get offset value
myScrollbar:getScrollOffset()This project is licensed under the MIT License - see the LICENSE file for details