.. _stdlib_ui_scroll_area_component: ============ UIScrollArea ============ .. das:module:: ui_scroll_area_component ++++++++++++ Enumerations ++++++++++++ .. _enum-ui_scroll_area_component-ScrollDirection: .. das:attribute:: ScrollDirection Defines the scrolling direction for a scroll area. :Values: * **Vertical** = 0 - Only vertical scrolling is enabled. * **Horizontal** = 1 - Only horizontal scrolling is enabled. * **Both** = 2 - Both vertical and horizontal scrolling are enabled. +++++++ Classes +++++++ .. _struct-ui_scroll_area_component-UIVerticalScrollbar: .. das:attribute:: UIVerticalScrollbar : UIComponent .. note:: ``UIFrame`` component is automatically added to the node if it is not already present A vertical scrollbar UI component with proportional handle sizing. The handle size automatically adjusts based on the visible ratio. :Fields: * **visibleRatio** : float = 0.5f - Ratio of visible content to total content (0-1). Controls handle size. * **onChange** : lambda<(offset:float):void> - Called when the scroll value changes via drag. * **handle** : :ref:`UIFrame `? - The frame component representing the scrollbar handle. * **track** : :ref:`UIFrame `? - The frame component representing the scrollbar track. If left empty, the frame of the node itself will be used. .. _function-ui_scroll_area_component_UIVerticalScrollbar_rq_on_initialize_UIVerticalScrollbar: .. das:function:: UIVerticalScrollbar.on_initialize() Initializes the scrollbar and sets up event listeners. .. _function-ui_scroll_area_component_UIVerticalScrollbar_rq_setValue_UIVerticalScrollbar_float: .. das:function:: UIVerticalScrollbar.setValue(newValue: float) : bool Sets the scroll offset value and updates the handle position. :Arguments: * **newValue** : float .. _function-ui_scroll_area_component_UIVerticalScrollbar_rq_invalidate_UIVerticalScrollbar: .. das:function:: UIVerticalScrollbar.invalidate() Updates the handle position and size based on scroll value and visible ratio. .. _function-ui_scroll_area_component_UIVerticalScrollbar_rq_start_drag_UIVerticalScrollbar: .. das:function:: UIVerticalScrollbar.start_drag() : bool Initializes the drag operation. .. _function-ui_scroll_area_component_UIVerticalScrollbar_rq_update_drag_UIVerticalScrollbar: .. das:function:: UIVerticalScrollbar.update_drag() Updates the scroll value based on the current mouse position. :Properties: .. _function-ui_scroll_area_component__dot__rq_value_UIVerticalScrollbar: .. das:operator:: UIVerticalScrollbar.value() : float Returns the current scroll offset value. .. _function-ui_scroll_area_component__dot__rq_value_rq_clone_UIVerticalScrollbar_float: .. das:operator:: UIVerticalScrollbar.value =(newValue: float) Sets the scroll offset value and updates the handle position. :Arguments: * **newValue** : float .. _struct-ui_scroll_area_component-UIHorizontalScrollbar: .. das:attribute:: UIHorizontalScrollbar : UIComponent .. note:: ``UIFrame`` component is automatically added to the node if it is not already present A horizontal scrollbar UI component with proportional handle sizing. The handle size automatically adjusts based on the visible ratio. :Fields: * **visibleRatio** : float = 0.5f - Ratio of visible content to total content (0-1). Controls handle size. * **onChange** : lambda<(offset:float):void> - Called when the scroll value changes via drag. * **handle** : :ref:`UIFrame `? - The frame component representing the scrollbar handle. * **track** : :ref:`UIFrame `? - The frame component representing the scrollbar track. If left empty, the frame of the node itself will be used. .. _function-ui_scroll_area_component_UIHorizontalScrollbar_rq_on_initialize_UIHorizontalScrollbar: .. das:function:: UIHorizontalScrollbar.on_initialize() Initializes the scrollbar and sets up event listeners. .. _function-ui_scroll_area_component_UIHorizontalScrollbar_rq_setValue_UIHorizontalScrollbar_float: .. das:function:: UIHorizontalScrollbar.setValue(newValue: float) : bool Sets the scroll offset value and updates the handle position. :Arguments: * **newValue** : float .. _function-ui_scroll_area_component_UIHorizontalScrollbar_rq_invalidate_UIHorizontalScrollbar: .. das:function:: UIHorizontalScrollbar.invalidate() Updates the handle position and size based on scroll value and visible ratio. .. _function-ui_scroll_area_component_UIHorizontalScrollbar_rq_start_drag_UIHorizontalScrollbar: .. das:function:: UIHorizontalScrollbar.start_drag() : bool Initializes the drag operation. .. _function-ui_scroll_area_component_UIHorizontalScrollbar_rq_update_drag_UIHorizontalScrollbar: .. das:function:: UIHorizontalScrollbar.update_drag() Updates the scroll value based on the current mouse position. :Properties: .. _function-ui_scroll_area_component__dot__rq_value_UIHorizontalScrollbar: .. das:operator:: UIHorizontalScrollbar.value() : float Returns the current scroll offset value. .. _function-ui_scroll_area_component__dot__rq_value_rq_clone_UIHorizontalScrollbar_float: .. das:operator:: UIHorizontalScrollbar.value =(newValue: float) Sets the scroll offset value and updates the handle position. :Arguments: * **newValue** : float .. _struct-ui_scroll_area_component-UIScrollArea: .. das:attribute:: UIScrollArea : UIComponent .. note:: ``UIFrame`` component is automatically added to the node if it is not already present A scroll area UI component that allows scrolling content behind a mask. The mask defines the visible area, and the content can be scrolled vertically and/or horizontally. Usage example:: def init_scroll_area() { get_component(node) $(var scrollArea : UIScrollArea?) { scrollArea.scrollSpeed = 20.0 scrollArea.onScroll = @(offset : float2) { print("Scrolled to {offset}") } } } :Fields: * **content** : :ref:`UIFrame `? - The frame component representing the scrollable content. * **maskArea** : :ref:`UIMask `? - The mask component defining the visible area. Note that the content node should be a child of the mask node for proper masking to work. * **verticalScrollbar** : :ref:`UIVerticalScrollbar `? - Optional vertical scrollbar component. * **horizontalScrollbar** : :ref:`UIHorizontalScrollbar `? - Optional horizontal scrollbar component. * **scrollSpeed** : float = 5f - Speed of scrolling. * **scrollDirection** : :ref:`ScrollDirection ` = ui_scroll_area_component::ScrollDirection.Both - The scrolling direction (Vertical, Horizontal, or Both). * **enableOverscroll** : bool = true - Whether to allow overscrolling beyond bounds with elastic bounce-back effect. * **elasticity** : float = 0.1f - Elasticity of overscroll bounce-back (how quickly it springs back). * **maxOverscrollRatio** : float = 0.5f - Maximum overscroll distance as a ratio of the mask size. * **enableInertia** : bool = true - Whether to enable inertia/momentum scrolling after input stops. * **decelerationRate** : float = 0.135f - Rate at which scrolling decelerates after input stops. Lower values = slower deceleration. * **onScroll** : lambda<(offset:float2):void> - Called when the scroll offset changes. .. _function-ui_scroll_area_component_UIScrollArea_rq_on_initialize_UIScrollArea: .. das:function:: UIScrollArea.on_initialize() Initializes the scroll area and sets up event listeners. .. _function-ui_scroll_area_component_UIScrollArea_rq_on_update_UIScrollArea: .. das:function:: UIScrollArea.on_update() Updates scroll area state, including inertia and bounce-back effects. .. _function-ui_scroll_area_component_UIScrollArea_rq_handleMouseWheel_UIScrollArea_float_KeyboardShifts: .. das:function:: UIScrollArea.handleMouseWheel(wheelDelta: float; shifts: KeyboardShifts) : bool Handles mouse wheel input and returns true if the event was consumed. :Arguments: * **wheelDelta** : float * **shifts** : :ref:`KeyboardShifts ` .. _function-ui_scroll_area_component_UIScrollArea_rq_updateScrollbarRanges_UIScrollArea: .. das:function:: UIScrollArea.updateScrollbarRanges() Updates the scrollbar handle sizes and interactability based on content and mask sizes. .. _function-ui_scroll_area_component_UIScrollArea_rq_setScrollOffset_UIScrollArea_float2: .. das:function:: UIScrollArea.setScrollOffset(newOffset: float2) : bool Sets the scroll offset and updates the content position. :Arguments: * **newOffset** : float2 .. _function-ui_scroll_area_component_UIScrollArea_rq_invalidate_UIScrollArea: .. das:function:: UIScrollArea.invalidate() Updates the content position based on scroll offset. .. _function-ui_scroll_area_component_UIScrollArea_rq_scroll_UIScrollArea_float2: .. das:function:: UIScrollArea.scroll(delta: float2) Scrolls by the given delta amount, applying resistance if overscrolling is enabled. :Arguments: * **delta** : float2 .. _function-ui_scroll_area_component_UIScrollArea_rq_scrollToTop_UIScrollArea: .. das:function:: UIScrollArea.scrollToTop() Scrolls to the top of the content. .. _function-ui_scroll_area_component_UIScrollArea_rq_scrollToBottom_UIScrollArea: .. das:function:: UIScrollArea.scrollToBottom() Scrolls to the bottom of the content. .. _function-ui_scroll_area_component_UIScrollArea_rq_scrollToLeft_UIScrollArea: .. das:function:: UIScrollArea.scrollToLeft() Scrolls to the left of the content. .. _function-ui_scroll_area_component_UIScrollArea_rq_scrollToRight_UIScrollArea: .. das:function:: UIScrollArea.scrollToRight() Scrolls to the right of the content. :Properties: .. _function-ui_scroll_area_component__dot__rq_scrollOffset_UIScrollArea: .. das:operator:: UIScrollArea.scrollOffset() : float2 Returns the current scroll offset. .. _function-ui_scroll_area_component__dot__rq_scrollOffset_rq_clone_UIScrollArea_float2: .. das:operator:: UIScrollArea.scrollOffset =(newOffset: float2) Sets the scroll offset and updates the content position. :Arguments: * **newOffset** : float2