Positioning scale
Add any UiElement using a builder
Builder for any UiElement
Index position or < 0 to push
Created UiElement
Add gap to Row. Gap can have fixed width and it also has custom logic which makes it occupy any extra space caused by setting the minimum size for Line.
Optional fixed size to set gap
Object itself
Disposes objects inside the element. UiElement will still be usable, but will not update itself nor render. Disposed elements can be restored using 'restore()' Implementations should use setEnabled on any other elements/Shapes they contain!
Object itself for fluent interface
Get auto dispose behavior for this UI element.
Auto dispose mode.
Get Background of object.
Type of Background is generic, see UIBackground for minimum interface.
Background object
Get dragging mode of object. Defines how the object can be dragged by mouse.
Object itself
True for highlighted state of object and false for basic
Get boolean flag for whether object is currently under mouse or not
Boolean for is object under mouse currently
Get margin around object in pixels.
Margin datastructure
Get amount of members in group.
Number
Returns list of UiElements inside Line
Get minimum size Layout should occupy (in direction of layout). If set, Layout will distribute any extra space to UiLayoutGaps among its members.
Min size Layout should occupy (in direction of layout) or undefined to disable feature
Get mouse interactions enabled.
True if any member of Layout has mouse interactions enabled.
Get mouse style.
Interface for defining how mouse should look when hovering over UI object
Get the position origin of this UiElement. Affects how the "position" of UIElement is interpreted.
Vec2 with each plane in range [-1, 1], where 0 is middle
Get padding around object in pixels. Padding is empty space between the UiElements content and Background
Margin datastructure
Returns the position of this UiElement at given location relative to elements size.
Relative position vector (-1 to 1 which specifies position of origin, 0 is center of the object)
Parameter to disregard parts of object when calculating the asked position.
Object itself for fluent itself
Returns the size of the UiElements in pixels including any Margins or Paddings
Parameter to disregard parts of object when calculating the position. Defaults to Margin, which includes everything. Should only ever be necessary for sub-classes
Object size in pixels
True if all sub-elements have been disposed, false if not.
Unsubscribe from Highlight object event. This is called whenever an object is highlighted
Token that was received when subscribing to the event.
True if the unsubscription was successful.
Remove event listener from Mouse Click Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Double Click Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Down Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Drag Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Drag Start Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Drag Stop Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Enter Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Leave Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Move Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Up Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Mouse Wheel Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Touch End Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Touch Move Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Remove event listener from Touch Start Event
Token of event listener which has to be removed
True if the listener is successfully removed and false if it is not found
Subscribe to highlight object event. This is called whenever an object is highlighted.
Function that is called when event is triggered.
Token that can be used to unsubscribe from the event.
Subscribe to Mouse Click event
Function that will be called when mouse clicks the bounds of UiObject.
Token-object that is a reference ID to the listener created.
Subscribe to Mouse Double Click event
Subscribe to Mouse Down event
Subscribe to Mouse Drag event
Subscribe to Mouse Drag Start event
Subscribe to Mouse Drag Stop event
Subscribe to Mouse Enter event
Function that will be called when mouse enters the bounds of UiObject.
Token-object that is a reference ID to the listener created.
Subscribe to Mouse Leave event
Function that will be called when mouse leaves the bounds of UiObject.
Token-object that is a reference ID to the listener created.
Subscribe to Mouse Move event
Event handler function
Token of subscription
Subscribe to Mouse Up event
Subscribe to Mouse Wheel event
Event handler function
Token of subscription
Subscribe to Touch End event
Event handler function
Token of subscription
Subscribe to Touch Move event
Event handler function
Token of subscription
Subscribe to Touch Start event
Event handler function
Token of subscription
Restore whatever resources this object has from rendering engine. Implementations should use setEnabled on any other elements/Shapes they contain!
Object itself itself for fluent interface
Set auto dispose behavior for this UI element.
Can be used to set a condition, where the UI element is automatically disposed, removing it from view.
// Example, remove UI element when it is larger than 20% of viewport.
UIElement.setAutoDisposeMode({
type: 'max-width',
maxWidth: 0.20,
})
Auto dispose mode.
Object itself for fluent interface.
Method for mutating Background of object.
Type of Background is generic, see UIBackground for minimum interface.
Mutator function for Background
Object itself for fluent interface
Set dragging mode of object. Defines how the object can be dragged by mouse.
See UIDraggingModescollection for options.
DraggingMode or undefined to disable dragging
Object itself
Set highlighted state of the Lines Background and all of its members
Highlight state of the object
Object itself for fluent interface
Set margin around object in pixels.
Number with pixel margins for all sides or datastructure with individual pixel margins for each side. Any side can be omitted, only passed values will be overridden.
Object itself
Set minimum size Layout should occupy (in direction of layout). If set, Layout will distribute any extra space to UiLayoutGaps among its members.
Min size Layout should occupy (in direction of layout) or undefined to disable feature
Object itself
Set mouse interactions enabled. This will set the states of all members inside the Layout, overriding any previous settings.
Mouse interactions enabled
Set mouse style when hovering over UI object.
Interface for defining how mouse should look when hovering over UI object
Object itself
Set padding around object in pixels. Padding is empty space between the UiElements content and Background
Number with pixel margins for all sides or datastructure with individual pixel paddings for each side. Any side can be omitted, only passed values will be overridden.
Object itself
Sets the position of this UiElement relative to its origin.
NOTE: UIElements scale can't be changed apart from when it is created.
Location on the UIElements scale, where its origin should be positioned
Object itself
UI Layout for positioning UIElements in a row.