deploy: 8b6eaccd18
This commit is contained in:
@@ -1,28 +1,34 @@
|
||||
# Input : VisualElement
|
||||
This is the input class. It provides a text input field that can handle user input with various features like
|
||||
cursor movement, text manipulation, placeholder text, and input validation.
|
||||
|
||||
## Properties
|
||||
|
||||
|Property|Type|Default|Description|
|
||||
|---|---|---|---|
|
||||
|text|string|Input|- text to be displayed
|
||||
|cursorPos|number|Input|- current cursor position
|
||||
|viewOffset|number|Input|- offset of view
|
||||
|text|string|-|The current text content of the input
|
||||
|cursorPos|number|1|The current cursor position in the text
|
||||
|viewOffset|number|0|The horizontal scroll offset for viewing long text
|
||||
|maxLength|number?|nil|Maximum length of input text (optional)
|
||||
|placeholder|string|...|Text to display when input is empty
|
||||
|placeholderColor|color|gray|Color of the placeholder text
|
||||
|focusedColor|color|blue|Background color when input is focused
|
||||
|pattern|string?|nil|Regular expression pattern for input validation
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Input.new](#Input.new)|Input|
|
||||
|[Input:blur](#Input:blur)|-|
|
||||
|[Input:char](#Input:char)|-|
|
||||
|[Input:focus](#Input:focus)|-|
|
||||
|[Input:init](#Input:init)|-|
|
||||
|[Input:key](#Input:key)|-|
|
||||
|[Input:mouse_click](#Input:mouse_click)|-|
|
||||
|[Input:render](#Input:render)|-|
|
||||
|[Input:updateViewport](#Input:updateViewport)|-|
|
||||
|[Input.new](#Input.new)|Input|Creates a new Input instance
|
||||
|[Input:blur](#Input:blur)|-|Handles blur events
|
||||
|[Input:char](#Input:char)|boolean|Handles char events
|
||||
|[Input:focus](#Input:focus)|-|Handles focus events
|
||||
|[Input:init](#Input:init)|Input|Initializes the Input instance
|
||||
|[Input:key](#Input:key)|boolean|Handles key events
|
||||
|[Input:mouse_click](#Input:mouse_click)|boolean|Handles mouse click events
|
||||
|[Input:render](#Input:render)|-|Renders the input element
|
||||
|[Input:updateViewport](#Input:updateViewport)|-|Updates the input's viewport
|
||||
|
||||
Neue Properties
|
||||
## Input.new()
|
||||
Creates a new Input instance
|
||||
|
||||
@@ -35,18 +41,54 @@ local element = Input.new("myId", basalt)
|
||||
```
|
||||
|
||||
## Input:blur()
|
||||
Handles blur events
|
||||
|
||||
## Input:char()
|
||||
## Input:char(char)
|
||||
Handles char events
|
||||
|
||||
### Parameters
|
||||
* `char` `string` The character that was typed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Input:focus()
|
||||
Handles focus events
|
||||
|
||||
## Input:init()
|
||||
## Input:init(props, basalt)
|
||||
Initializes the Input instance
|
||||
|
||||
## Input:key()
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## Input:mouse_click()
|
||||
### Returns
|
||||
* `Input` `self` The initialized instance
|
||||
|
||||
## Input:key(key)
|
||||
Handles key events
|
||||
|
||||
### Parameters
|
||||
* `key` `number` The key that was pressed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Input:mouse_click(button, x, y)
|
||||
Handles mouse click events
|
||||
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Input:render()
|
||||
Renders the input element
|
||||
|
||||
## Input:updateViewport()
|
||||
Updates the input's viewport
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user