deploy: fc44bc4d8b
This commit is contained in:
@@ -1,58 +1,97 @@
|
||||
# Scrollbar : VisualElement
|
||||
A scrollbar element that can be attached to other elements to control their scroll properties
|
||||
# ScrollBar
|
||||
_A ScrollBar element that can be attached to other elements to control their scroll properties_
|
||||
|
||||
Extends: `VisualElement`
|
||||
|
||||
## Properties
|
||||
|
||||
|Property|Type|Default|Description|
|
||||
|---|---|---|---|
|
||||
|value|number|0|Current scroll value
|
||||
|min|number|0|Minimum scroll value
|
||||
|max|number|100|Maximum scroll value
|
||||
|step|number|1|Step size for scroll operations
|
||||
|dragMultiplier|number|1|How fast the scrollbar moves when dragging
|
||||
|symbol|string|"|" Symbol used for the scrollbar handle
|
||||
|backgroundSymbol|string|"\127"|Symbol used for the scrollbar background
|
||||
|symbolBackgroundColor|color|black|Background color of the scrollbar handle
|
||||
|backgroundSymbol|string|"\127"|Symbol used for the scrollbar background
|
||||
|attachedElement|table?|nil|The element this scrollbar is attached to
|
||||
|attachedProperty|string?|nil|The property being controlled
|
||||
|minValue|number|function|0|Minimum value or function that returns it
|
||||
|maxValue|number|function|100|Maximum value or function that returns it
|
||||
|orientation|string|vertical|Orientation of the scrollbar ("vertical" or "horizontal")
|
||||
|handleSize|number|2|Size of the scrollbar handle in characters
|
||||
|value|number|0|Current scroll value|
|
||||
|min|number|0|Minimum scroll value|
|
||||
|max|number|100|Maximum scroll value|
|
||||
|step|number|1|Step size for scroll operations|
|
||||
|dragMultiplier|number|1|How fast the ScrollBar moves when dragging|
|
||||
|symbol|string|"|" Symbol used for the ScrollBar handle|
|
||||
|backgroundSymbol|string|"\127"|Symbol used for the ScrollBar background|
|
||||
|symbolBackgroundColor|color|black|Background color of the ScrollBar handle|
|
||||
|backgroundSymbol|string|"\127"|Symbol used for the ScrollBar background|
|
||||
|minValue|number|function|0|Minimum value or function that returns it|
|
||||
|maxValue|number|function|100|Maximum value or function that returns it|
|
||||
|orientation|string|vertical|Orientation of the ScrollBar ("vertical" or "horizontal")|
|
||||
|handleSize|number|2|Size of the ScrollBar handle in characters|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Scrollbar:attach](#scrollbar-attach)|Scrollbar|Attaches the scrollbar to an element's property
|
||||
|[Scrollbar:updateAttachedElement](#scrollbar-updateattachedelement)|Scrollbar|Updates the attached element's property based on the scrollbar value
|
||||
|[ScrollBar.new](#scrollbar-new)|ScrollBar|Creates a new ScrollBar instance|
|
||||
|[ScrollBar:init](#scrollbar-init-props-basalt)|ScrollBar|Initializes the ScrollBar instance|
|
||||
|[ScrollBar:attach](#scrollbar-attach-element-config)|ScrollBar|Attaches the ScrollBar to an element's property|
|
||||
|[ScrollBar:updateAttachedElement](#scrollbar-updateattachedelement)|ScrollBar|Updates the attached element's property based on the ScrollBar value|
|
||||
|[ScrollBar:mouse_click](#scrollbar-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[ScrollBar:mouse_drag](#scrollbar-mouse-drag-button-x-y)|boolean|Handles mouse drag events|
|
||||
|[ScrollBar:mouse_scroll](#scrollbar-mouse-scroll-direction-x-y)|boolean|Handles mouse scroll events|
|
||||
|[ScrollBar:render](#scrollbar-render)|-|Renders the ScrollBar|
|
||||
|
||||
## ScrollBar.new()
|
||||
|
||||
## Protected Functions
|
||||
Creates a new ScrollBar instance
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|Scrollbar:init|Scrollbar|Initializes the Scrollbar instance
|
||||
|Scrollbar:mouse_click|boolean|Handles mouse click events
|
||||
|Scrollbar:mouse_drag|boolean|Handles mouse drag events
|
||||
|Scrollbar:mouse_scroll|boolean|Handles mouse scroll events
|
||||
|Scrollbar:render|-|Renders the scrollbar
|
||||
### Returns
|
||||
* `ScrollBar` `self` The newly created ScrollBar instance
|
||||
|
||||
## Scrollbar:attach(element, config)
|
||||
Attaches the scrollbar to an element's property
|
||||
## ScrollBar:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `ScrollBar` `self` The initialized instance
|
||||
|
||||
## ScrollBar:attach(element, config)
|
||||
|
||||
Attaches the ScrollBar to an element's property
|
||||
|
||||
### Parameters
|
||||
* `element` `BaseElement` The element to attach to
|
||||
* `config` `table` Configuration {property = "propertyName", min = number|function, max = number|function}
|
||||
|
||||
### Returns
|
||||
* `Scrollbar` `self` The scrollbar instance
|
||||
* `ScrollBar` `self` The ScrollBar instance
|
||||
|
||||
## Scrollbar:updateAttachedElement()
|
||||
Updates the attached element's property based on the scrollbar value
|
||||
## ScrollBar:updateAttachedElement()
|
||||
|
||||
Updates the attached element's property based on the ScrollBar value
|
||||
|
||||
### Returns
|
||||
* `Scrollbar` `self` The scrollbar instance
|
||||
* `ScrollBar` `self` The ScrollBar instance
|
||||
|
||||
## ScrollBar:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The mouse button clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## ScrollBar:mouse_drag(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The mouse button being dragged
|
||||
* `x` `number` The x position of the drag
|
||||
* `y` `number` The y position of the drag
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## ScrollBar:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The scroll direction (1 for up, -1 for down)
|
||||
* `x` `number` The x position of the scroll
|
||||
* `y` `number` The y position of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## ScrollBar:render()
|
||||
Reference in New Issue
Block a user