Class: UIPrompt
The `UIPrompt` class represents a user interface prompt with a text content and a menu of actions.
Constructors
- new UIPrompt(): UIPrompt
The constructor.
Methods
- addAction(id: string, text: string): void
The "addAction" function adds a new menu button.
- id: A string representing the unique identifier for the action. This is used to
identify the action when it is selected or triggered.
- text: The "text" parameter is a string that represents the text or label for the
action that you want to add to the UI menu.
- animate(animation: string): void
The "animate" function trigger animation to the widget `node` HTMLElement.
- animation: The `animation` parameter is a string that represents the name of the
animation to be applied to the `node` HTMLElement.
- appendChild(child: HTMLElement): void
The "appendChild" function appends a given HTML element as a child to the widget node.
- child: The `child` parameter is an instance of the `HTMLElement` class. It
represents an HTML element that you want to append to the widget node.
- appendStyles(styles: string): void
The "appendStyles" function appends CSS styles to the `node` HTMLElement.
- styles: The `styles` parameter is a string that represents CSS styles that you want
to append to the `cssText` property of the `node` object.
- clearActions(): void
The "clearActions" function remove all menu buttons.
- delete(): void
The "delete" function free all resources.
Warning: you need to call this method to free allocation for this object.
- focus(): void
The "focus" function.
- getId(): string
- getNode(): HTMLDivElement
The "getNode" function returns the root `node` HTMLElement of the widget.
- getPosition(): vec2
The "getPosition" function returns the relative x and y coordinates of the widget `node` HTMLElement.
- getScreenPosition(): vec2
The "getScreenPosition" function returns the left and top coordinates of the widget `node` HTMLElement on
the screen.
- handleMenuItemSelected(data: any): void
The "handleMenuItemSelected" function.
It emits an 'E_ITEM_SELECTED' event with the data passed as a parameter.
- data: The `data` parameter is of type `any`, which means it can be any data type. It
represents the data associated with the selected menu item.
- isEnabled(): boolean
The "isEnabled" function checks if widget is enabled or not.
- isFocused(): boolean
The "isFocused" function checks if widget is focused.
- isSelected(): boolean
The "isSelected" function checks if widget is selected or not.
- isVisible(): boolean
The "isVisible" function checks if the widget is visible.
- onAction(actionId: string): void
The "onAction" function is a virtual method that is called when input action event is emitted.
- actionId: The `actionId` parameter is a string that represents the identifier of the
action being performed.
- removeAction(id: string): void
The "removeAction" function remove the specified menu button.
- id: The `id` parameter is a string that represents the unique identifier of the
action to be removed from the UI menu.
- removeChild(index: number): void
The "removeChild" function removes a child element from the widget node.
- index: The index parameter is the position of the child element that you want to
remove from the widget node.
- setEnabled(enabled: boolean): void
The "setEnabled" function sets the enabled state flag.
It is just to expose a convenient option to the user, this flag has not effect on the UI manager.
Nota bene: toggle the `u-disabled` class on `node`.
- enabled: The `enabled` parameter is a boolean value that determines whether the
widget is enabled or disabled.
- setId(id: string): void
The "setId" function sets the id property.
- id: A string representing the unique identifier to be set.
- setPosition(x: number, y: number): void
The "setPosition" function sets the left and top position to the widget `node` HTMLElement.
Nota bene: works only if position is `absolute`.
- x: The horizontal position of the element on the page.
- y: The vertical position of the element on the page.
- setSelected(selected: boolean): void
The "setSelected" function sets the selected state flag.
It is just to expose a convenient option to the user, this flag has not effect on the UI manager.
Nota bene: toggle the `u-selected` class on `node`.
- selected: The `selected` parameter is a boolean value that indicates whether the
element should be selected or not.
- setText(text: string): void
The "setText" function sets the text message.
- text: The `text` parameter is a string that represents the text content that you
want to set.
- setVisible(visible: boolean): void
The "setVisible" function sets the visibility state.
Nota bene: toggle the `u-hidden` class on `node`.
- visible: The `visible` parameter is a boolean value that determines whether the
element should be visible or hidden. If `visible` is true, the element will be displayed, otherwise
it will be hidden.
- unfocus(): void
The "unfocus" function.
- update(ts: number): void
The "update" function.
- ts: The `ts` parameter stands for "timestep".