Class UIFixedSpace

UI element that may be inserted into layouts in order to make a space of a fixed size.

Hierarchy (view full)

Constructors

  • Creates a new fixed space UI element.

    Parameters

    • size: number
    • Optionalscalable: boolean
    • OptionalisInternalConstructor: boolean

    Returns UIFixedSpace

Accessors

  • get bounds(): Immutable<Rect2>
  • Sets the bounds of the UI element. Relative to a parent UI panel. Equivalent to calling setPosition(), setWidth() and setHeight().

    If scalable is set to true, the size will be scaled linearly with the DPI scaling factor of the surface the elements gets attached. It false, the element will have this exact size no matter the DPI scaling factor.

    Returns Immutable<Rect2>

  • set bounds(value): void
  • Parameters

    Returns void

  • get boundsInPixels(): Immutable<Rect2>
  • Gets or sets non-clipped bounds of the UI element in pixels. Relative to a parent UI panel.

    Returns Immutable<Rect2>

  • set boundsInPixels(value): void
  • Parameters

    Returns void

  • get clippedVisibleBounds(): Immutable<Rect2>
  • Returns the clipped bounds of the UI element including the margins. Relative to a parent UI panel.

    Returns Immutable<Rect2>

  • get clippedVisibleBoundsInPixels(): Immutable<Rect2>
  • Returns the clipped bounds of the UI element including the margins. Relative to a parent UI panel.

    Returns Immutable<Rect2>

  • get clippedVisibleScreenBounds(): Immutable<Rect2>
  • Returns the clipped bounds of the UI element including the margins. In Screenspace.

    Returns Immutable<Rect2>

  • get clippedVisibleScreenBoundsInPixels(): Immutable<Rect2>
  • Returns the clipped bounds of the UI element including the margins. In Screenspace.

    Returns Immutable<Rect2>

  • get debugName(): string
  • Sets the debug name for the UI element.

    Returns string

  • set debugName(value): void
  • Parameters

    • value: string

    Returns void

  • get disabled(): boolean
  • Disables or enables the element. Disabled elements cannot be interacted with and have a faded out appearance.

    Returns boolean

  • set disabled(value): void
  • Parameters

    • value: boolean

    Returns void

  • get displayType(): EnumValue<UIDisplayType, number>
  • Hides or shows this element and recursively applies the same state to all the child elements. This will not remove the element from the layout, the room for it will still be reserved but it just won't be visible.

    Returns EnumValue<UIDisplayType, number>

  • set displayType(value): void
  • Parameters

    Returns void

  • get dpiScale(): number
  • Gets the scaling factor for the element's parent surface. This element must be attached to a valid surface in order to retrieve the scale factor. If the element is not attached to a surface, 1.0 is returned.

    Returns number

    The scale factor for the element's parent surface.

  • get fixedHeight(): number
  • Sets the element size to be fixed using the specified value.

    Returns number

  • set fixedHeight(value): void
  • Parameters

    • value: number

    Returns void

  • set fixedHeightInPixels(value): void
  • Sets the element size to be fixed using the specified value in pixels.

    Parameters

    • value: number

    Returns void

  • get fixedWidth(): number
  • Sets the element size to be fixed using the specified value.

    Returns number

  • set fixedWidth(value): void
  • Parameters

    • value: number

    Returns void

  • set fixedWidthInPixels(value): void
  • Sets the element size to be fixed using the specified value in pixels.

    Parameters

    • value: number

    Returns void

  • get isDestroyed(): boolean
  • Checks if the underlying native UIElement has been destroyed.

    Returns boolean

  • get isLayoutBarrier(): boolean
  • Specifies that layout passes of children elements should start from this element.

    Returns boolean

  • set isLayoutBarrier(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isUpdating(): boolean
  • Specifies that per-frame updates are enabled. If enabled, the element's onUpdate method will be called every frame.

    Returns boolean

    Per-frame updates are expensive and most UI elements should be built using a fully event-driven approach. Do not enable per-frame updates unless there is no event available that can be used to drive the required behavior.

  • set isUpdating(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isVisible(): boolean
  • Activates or deactivates this element and recursively applies the same state to all the child elements. This has the same effect as SetDisplayType(UIDisplayType::Hidden), but when disabled it will also remove the element from the layout, essentially having the same effect is if you destroyed the element.

    Returns boolean

  • set isVisible(value): void
  • Parameters

    • value: boolean

    Returns void

  • get minimumHeight(): number
  • Sets the minimum height in points of the element when used in a layout.

    Returns number

  • set minimumHeight(value): void
  • Parameters

    • value: number

    Returns void

  • get minimumWidth(): number
  • Sets the minimum width in points of the element when used in a layout.

    Returns number

  • set minimumWidth(value): void
  • Parameters

    • value: number

    Returns void

  • get parent(): UIElementBase
  • Returns the layout this element belongs to, if any.

    Returns UIElementBase

  • get position(): Immutable<Vector2>
  • Sets element position relative to parent UI panel in points.

    Returns Immutable<Vector2>

    Be aware that this value will be ignored if UI element is part of a layout since then the layout controls its placement.

  • set position(value): void
  • Parameters

    Returns void

  • set positionInteger(value): void
  • Sets element position relative to parent UI panel in pixels.

    Parameters

    Returns void

    Be aware that this value will be ignored if UI element is part of a layout since then the layout controls its placement.

  • get readOnly(): boolean
  • Disables or enables the element. Disabled elements cannot be interacted with and have a faded out appearance.

    Returns boolean

  • set readOnly(value): void
  • Parameters

    • value: boolean

    Returns void

  • get screen(): Screen
  • Returns the screen on which the element is displayed, if any.

    Returns Screen

  • get screenBounds(): Immutable<Rect2>
  • Returns non-clipped bounds of the UI element in screenspace.

    Returns Immutable<Rect2>

    This call can be potentially expensive if the UI state is dirty.

  • get screenBoundsInPixels(): Immutable<Rect2>
  • Returns non-clipped bounds of the UI element in screenspace.

    Returns Immutable<Rect2>

    This call can be potentially expensive if the UI state is dirty.

  • get size(): number
  • Changes the size of the space to the specified value, in points.

    Returns number

  • set size(value): void
  • Parameters

    • value: number

    Returns void

  • get sizeHint(): Immutable<Size2>
  • Gets the size hint for this element.

    Returns Immutable<Size2>

    The size hint represents an approximation of the size. The actual size depends on the layouting that is done by the parent element. Layouts typically use the size hint to calculate the intial size of the element when distributing the available layout space.

  • get sizeHintInPixels(): Immutable<Vector2>
  • Gets the size hint for this element.

    Returns Immutable<Vector2>

    The size hint represents an approximation of the size. The actual size depends on the layouting that is done by the parent element. Layouts typically use the size hint to calculate the intial size of the element when distributing the available layout space.

  • get visibleBounds(): Immutable<Rect2>
  • Returns non-clipped visible bounds of the UI element (bounds exclude the margins). Relative to the parent UI panel.

    Returns Immutable<Rect2>

    This call can be potentially expensive as the bounds need to be calculated based on current UI state.

  • get visibleBoundsInPixels(): Immutable<Rect2>
  • Returns non-clipped visible bounds of the UI element (bounds exclude the margins). Relative to the parent UI panel.

    Returns Immutable<Rect2>

    This call can be potentially expensive as the bounds need to be calculated based on current UI state.

  • get window(): RenderWindow
  • Get the window in which the element is positioned.

    Returns RenderWindow

Methods

  • Creates an animation that executes an action lambda once the delay elapsed.

    Parameters

    • action: (() => void)

      The action to execute.

        • (): void
        • Returns void

    • Optionaldelay: number

      The delay until the action is executed. Defaults to no delay.

    • Optionalrepeating: number | boolean

      Whether the animation should repeat or not. Defaults to false. Set to true, to repeat forever. Set to false, to never repeat. Set to a number, to indicate the repeat count.

    Returns EditorAnimation

    The created animation.

  • Animates a property of the UIElement. The animation is automatically started.

    Type Parameters

    • T

      The type of property to be animated.

    Parameters

    • propertyName: string

      The name of the property to be animated on the UIElement.

    • starting: T

      The starting value of the property.

    • ending: T

      The ending value of the property.

    • Optionalduration: number

      The animation duration in seconds. Defaults to 1 seconds.

    • OptionaleasingCurve: Const<EasingCurve>

      The easing curve to be used. Defaults to

    • Optionalrepeating: number | boolean

      Whether the animation should repeat or not. Defaults to false. Set to true, to repeat forever. Set to false, to never repeat. Set to a number, to indicate the repeat count.

    Returns EditorAnimation

    The created animation.

    EasingCurve.inOutQuadratic.

  • Animates a property of the UIElement using a generic lambda function. The animation is automatically started.

    Type Parameters

    • T

    Parameters

    • setter: ((value: T) => void)

      The lambda that is called when the value is updated. The lambda should be used to assign the value on the u

        • (value): void
        • Parameters

          • value: T

          Returns void

    • starting: T

      The starting value of the property.

    • ending: T

      The ending value of the property.

    • Optionalduration: number

      The animation duration in seconds. Defaults to 1 seconds.

    • OptionaleasingCurve: Const<EasingCurve>

      The easing curve to be used. Defaults to

    • Optionalrepeating: number | boolean

      Whether the animation should repeat or not. Defaults to false. Set to true, to repeat forever. Set to false, to never repeat. Set to a number, to indicate the repeat count.

    Returns EditorAnimation

    The created animation.

    EasingCurve.inOutQuadratic.

  • Creates an animation that takes delay seconds to execute.

    Parameters

    • delay: number

      The delay in seconds.

    Returns EditorAnimation

    The created animation.

    This animation is usedful when creating compound animations that are chained together by calls to then. This is helpful to create an animation that performs an action, waits and performs another action.

  • Virtual

    Destroys this element and all its children. Removes the element from parent layout/panel.

    Returns void

    Calling methods on a destroyed element is a no-operation. Destroyed elements aren't allowed to be assigned as children of other elements, or be parents of other elements.

  • Updates the layout of the UI element. Updates child elements positions, sizes, clip rectangles and depths so they fit into the provided bounds, while respecting their layout options.

    Returns void

    This may trigger the layout of more than this element and it's children! It can potentially update the layout of the whole UI tree.

  • Returns non-clipped bounds of the UI element. Relative to a parent UI panel.

    Parameters

    • OptionalrelativeTo: UIElementBase

      Parent panel of the provided element relative to which to return the bounds. If null the bounds relative to the first parent panel are returned. Behavior is undefined if provided panel is not a parent of the element.

    Returns Rect2

    This call can be potentially expensive if the UI state is dirty.

  • Virtual

    Called when the element has been added to a surface or window.

    Returns void

    This event allows to immediately access the layout data and bounds of the element and it's immediate parents and children. The event is helpful to perform initialization and registration to events. Implementing classes must call super.

  • Virtual

    Called when the element has been removed from a surface or window.

    Returns void

    Layout data and bounds will no longer be available at this point. The event is helpful to perform cleanup and unregistration from events. Implementing classes must call super.

  • Virtual

    Called when the element has been registered with its parent.

    Returns void

  • Virtual

    Called when the element is about to be unregistered from its parent.

    Returns void

  • Virtual

    Called when the element is updating.

    Returns void

    This is method is only called if the element has been marked as requiring updates.

    Per-frame updates are expensive and most UI elements should be built using a fully event-driven approach. Do not enable per-frame updates unless there is no event available that can be used to drive the required behavior.

  • Virtual

    Resets element dimensions to their initial values dictated by the element's style.

    Returns void

  • Sets the bounds of the UI element. Relative to a parent UI panel. Equivalent to calling setPosition(), setWidth() and setHeight().

    If scalable is set to true, the size will be scaled linearly with the DPI scaling factor of the surface the elements gets attached. It false, the element will have this exact size no matter the DPI scaling factor.

    Parameters

    Returns void

  • Sets element height in pixels. Element will be resized according to its contents and parent layout but will always stay within the provided range. If maximum height is zero, the element is allowed to expand as much as it needs.

    If scalable is set to true, the minimum and maximum heights will be scaled linearly with the DPI scaling factor of the surface the elements gets attached. It false, the element will have this exact size no matter the DPI scaling factor.

    Parameters

    • OptionalminHeight: number
    • OptionalmaxHeight: number
    • Optionalscalable: boolean

    Returns void

  • Sets element width in pixels. Element will be resized according to its contents and parent layout but will always stay within the provided range. If maximum width is zero, the element is allowed to expand as much as it needs.

    If scalable is set to true, the minimum and maximum widths will be scaled linearly with the DPI scaling factor of the surface the elements gets attached. It false, the element will have this exact size no matter the DPI scaling factor.

    Parameters

    • OptionalminWidth: number
    • OptionalmaxWidth: number
    • Optionalscalable: boolean

    Returns void

  • Changes the size of the space to the specified value, in points. If scalable is true, this value will be scaled by the widget scaling factor.

    Parameters

    • size: number
    • scalable: boolean

    Returns void

  • Unregisters all running animations for the UIElement.

    Returns number

    The number of animations that were unregistered.

  • Scales a point value by using the element's DPI scale to the current pixel value.

    Parameters

    • valueInPoints: number

      The element to scale a value for. This element must be attached to a valid widget in order to retrieve the scale factor. If the element is not attached to a widget, no scaling is performed.

    Returns number

    The value in pixels.

  • Scales a point value by using the element's DPI scale to the current pixel value.

    Parameters

    • valueInPoints: Immutable<Vector2>

      The element used to get the DPI scaling factor.

    Returns Vector2

    Result value in pixels.

  • Converts a pixel value to points by using the element's DPI scale.

    Parameters

    • valueInPixels: number

      The element to scale a value for. This element must be attached to a valid widget in order to retrieve the scale factor. If the element is not attached to a widget, no scaling is performed.

    Returns number

    The value in points.

  • Scales a point value by using the element's DPI scale to the current point value.

    Parameters

    • valueInPixels: Immutable<Vector2>

      The element used to get the DPI scaling factor.

    Returns Vector2

    Result value in points.

  • Renders a UI element into a texture.

    Parameters

    • element: UIElementBase

      The UI element to be drawn to a texture.

    • skin: UISkin | ResourceHandle<UISkin>

      The UI skin to be used to render the element.

    • sizeInPixels: Immutable<Size2>

      The size of the UI texture to draw.

    • OptionalscalingFactor: number

      The DPI scaling factor of the RenderTarget. Can be used to linearly scale the entire UI, including text.

    • OptionalclearColor: Immutable<SRGBColor>

      The clear color. (Default: [0, 0, 0, 0])

    Returns AsyncOp<ResourceHandle<Texture>, void>

    An async operation that returns the rendered texture once rendering has been completed by the GPU.

    Calling this method will detach the given element from it's current parent.

Events

onLayoutSizeChanged: Event<[Immutable<Size2>, Immutable<Size2>], void>

Event fired whenever the UI element size changes from a layout update.

The old size of the UI element, in points.

The new size of the UI element, in points.

onRegistrationChanged: Event<[boolean], void>

Event fired whenever the UI element is registered with or unregistered from a parent element.

This does not mean that the element is currently visible on screen or that it is part of a layout. Use onActiveSurfaceChanged to determine if the element is part of a layout that is currently rendered.

True if the new state is registered in a parent element.

onActiveSurfaceChanged: Event<[boolean], void>

Event fired whenever the UI element is registered with or unregistered from a surface.

True if the new state is registered in a surface.