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,12 +28,14 @@ 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 |
@ -49,6 +51,7 @@ Properties that apply to all elements:
| 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,12 +28,14 @@ Id элемента не может быть изменен из скрипта.
document["worlds-panel"]:clear() document["worlds-panel"]:clear()
``` ```
Доступ к вложенным элементам производится по индексу (с единицы).
## Общие свойства и методы ## Общие свойства и методы
Свойства, относящиеся ко всем элементам: Свойства, относящиеся ко всем элементам:
| Название | Тип | Чтение | Запись | Описание | | Название | Тип | Чтение | Запись | Описание |
| ------------- | ------ | ------ | ------ | ----------------------------------------- | | ------------- | ------- | ------ | ------ | ----------------------------------------- |
| id | string | да | *нет* | идентификатор элемента | | id | string | да | *нет* | идентификатор элемента |
| pos | vec2 | да | да | позиция элемента внутри контейнера | | pos | vec2 | да | да | позиция элемента внутри контейнера |
| wpos | vec2 | да | да | позиция элемента в окне | | wpos | vec2 | да | да | позиция элемента в окне |
@ -49,6 +51,7 @@ document["worlds-panel"]:clear()
| tooltipDelay | float | да | да | задержка всплывающей подсказки | | tooltipDelay | float | да | да | задержка всплывающей подсказки |
| contentOffset | vec2 | да | *нет* | смещение содержимого | | contentOffset | vec2 | да | *нет* | смещение содержимого |
| cursor | string | да | да | курсор, отображаемый при наведении | | cursor | string | да | да | курсор, отображаемый при наведении |
| parent | Element | да | *нет* | родительский элемент или nil |
Общие методы элементов: Общие методы элементов: