update doc/*/scripting/ui.md

This commit is contained in:
MihailRis 2025-04-17 20:05:09 +03:00
parent 559f946a66
commit 41ec44b6ee
2 changed files with 40 additions and 34 deletions

View File

@ -28,27 +28,30 @@ For example:
document["worlds-panel"]:clear() document["worlds-panel"]:clear()
``` ```
Access to nested elements is performed by index (starting from one).
## General properties and methods ## General properties and methods
Properties that apply to all elements: Properties that apply to all elements:
| Name | Type | Read | Write | Description | | Name | Type | Read | Write | Description |
| ------------- | ------ | ---- | ----- | ------------------------------------------- | | ------------- | ------- | ---- | ----- | ------------------------------------------- |
| id | string | yes | *no* | element id | | id | string | yes | *no* | element id |
| pos | vec2 | yes | yes | element position inside a container | | pos | vec2 | yes | yes | element position inside a container |
| wpos | vec2 | yes | yes | element position inside the window | | wpos | vec2 | yes | yes | element position inside the window |
| size | vec2 | yes | yes | element size | | size | vec2 | yes | yes | element size |
| interactive | bool | yes | yes | ability to interact with the element | | interactive | bool | yes | yes | ability to interact with the element |
| enabled | bool | yes | yes | visually indicated version of *interactive* | | enabled | bool | yes | yes | visually indicated version of *interactive* |
| visible | bool | yes | yes | element visibility | | visible | bool | yes | yes | element visibility |
| focused | bool | yes | yes | focus on element | | focused | bool | yes | yes | focus on element |
| color | rgba | yes | yes | element color | | color | rgba | yes | yes | element color |
| hoverColor | rgba | yes | yes | hover color | | hoverColor | rgba | yes | yes | hover color |
| pressedColor | rgba | yes | yes | color when pressed | | pressedColor | rgba | yes | yes | color when pressed |
| tooltip | string | yes | yes | tooltip text | | tooltip | string | yes | yes | tooltip text |
| tooltipDelay | float | yes | yes | tooltip delay | | tooltipDelay | float | yes | yes | tooltip delay |
| contentOffset | vec2 | yes | *no* | element content offset | | contentOffset | vec2 | yes | *no* | element content offset |
| cursor | string | yes | yes | cursor displayed on hover | | cursor | string | yes | yes | cursor displayed on hover |
| parent | Element | yes | *no* | parent element or nil |
Common element methods: Common element methods:

View File

@ -28,27 +28,30 @@ Id элемента не может быть изменен из скрипта.
document["worlds-panel"]:clear() document["worlds-panel"]:clear()
``` ```
Доступ к вложенным элементам производится по индексу (с единицы).
## Общие свойства и методы ## Общие свойства и методы
Свойства, относящиеся ко всем элементам: Свойства, относящиеся ко всем элементам:
| Название | Тип | Чтение | Запись | Описание | | Название | Тип | Чтение | Запись | Описание |
| ------------- | ------ | ------ | ------ | ----------------------------------------- | | ------------- | ------- | ------ | ------ | ----------------------------------------- |
| id | string | да | *нет* | идентификатор элемента | | id | string | да | *нет* | идентификатор элемента |
| pos | vec2 | да | да | позиция элемента внутри контейнера | | pos | vec2 | да | да | позиция элемента внутри контейнера |
| wpos | vec2 | да | да | позиция элемента в окне | | wpos | vec2 | да | да | позиция элемента в окне |
| size | vec2 | да | да | размер элемента | | size | vec2 | да | да | размер элемента |
| interactive | bool | да | да | возможность взаимодействия с элементом | | interactive | bool | да | да | возможность взаимодействия с элементом |
| enabled | bool | да | да | визуально обозначаемая версия interactive | | enabled | bool | да | да | визуально обозначаемая версия interactive |
| visible | bool | да | да | видимость элемента | | visible | bool | да | да | видимость элемента |
| focused | bool | да | да | фокус на элементе | | focused | bool | да | да | фокус на элементе |
| color | rgba | да | да | цвет элемента | | color | rgba | да | да | цвет элемента |
| hoverColor | rgba | да | да | цвет при наведении | | hoverColor | rgba | да | да | цвет при наведении |
| pressedColor | rgba | да | да | цвет при нажатии | | pressedColor | rgba | да | да | цвет при нажатии |
| tooltip | string | да | да | текст всплывающей подсказки | | tooltip | string | да | да | текст всплывающей подсказки |
| tooltipDelay | float | да | да | задержка всплывающей подсказки | | tooltipDelay | float | да | да | задержка всплывающей подсказки |
| contentOffset | vec2 | да | *нет* | смещение содержимого | | contentOffset | vec2 | да | *нет* | смещение содержимого |
| cursor | string | да | да | курсор, отображаемый при наведении | | cursor | string | да | да | курсор, отображаемый при наведении |
| parent | Element | да | *нет* | родительский элемент или nil |
Общие методы элементов: Общие методы элементов: