ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::ScrollController Struct Reference

Per-node overflow, scrolling and scrollbar state machine. More...

#include <ScrollController.hpp>

Public Member Functions

bool needsFullArrange (const Layout &node, bool positionChanged) const
 true if a full re-arrange is needed before applying an offset delta.
Rect computeArrangeSpace (const Layout &node, Rect space) const
 Compute the space to pass to Layout::arrangeInto.
bool applyOffsetDelta (Layout &node)
 Translate the subtree by the delta between state.offset and appliedOffset.
void updateMaxScroll (const Layout &node, Rect space)
 Recompute state.maxScroll from contentSize and the node's rect.
void reset ()
 Reset offset, bounds, velocity and scroll-activity flags.
void tickInput (Layout &node)
 Process pointer and wheel input for this scroll container.
void drawScrollbar (const Layout &node, float parentOpacity) const
 Draw the vertical and/or horizontal scrollbars.
Rect verticalThumb (const Layout &node) const
 Compute the vertical scrollbar thumb rectangle in screen space.
Rect horizontalThumb (const Layout &node) const
 Compute the horizontal scrollbar thumb rectangle in screen space.
void resetIfOverflowChanged (const Layout &node)
 Detect overflow style changes and reset scroll state if any.

Public Attributes

ScrollState state
Vec2 contentSize {0, 0}
Vec2 appliedOffset {0, 0}
int dragAxis {0}
Overflow lastOverflowX {Overflow::Visible}
Overflow lastOverflowY {Overflow::Visible}
bool arrangeInitialized {false}
bool scrolling {false}
bool overflowInitialized {false}

Detailed Description

Per-node overflow, scrolling and scrollbar state machine.

Fields are public by design: Layout reads and writes them directly, and Render.cpp reads contentSize for hit-test-relevant calculations.


The documentation for this struct was generated from the following file: