|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
CPU-side scroll offset for a bounded content region. More...
#include <ScrollState.hpp>
Collaboration diagram for MayaFlux::Kinesis::ScrollState:Public Attributes | |
| AABB2D | content_bounds { .min = glm::vec2(-1.F), .max = glm::vec2(1.F) } |
| glm::vec2 | offset { 0.F, 0.F } |
| AABB2D | viewport_bounds { .min = glm::vec2(-1.F), .max = glm::vec2(1.F) } |
CPU-side scroll offset for a bounded content region.
The interactable half of scrolling. offset is a content-space translation, clamped so a viewport of viewport_bounds's size never scrolls past content_bounds. offset increases as the view moves deeper into content: zero shows the top-left of content_bounds, the clamped maximum shows its bottom-right.
content_bounds is not clamped to NDC. It is whatever extent the content actually occupies (the accumulated height of every row a LayoutCursor has advanced through, typically), routinely far taller than the [-1, 1] a viewport can show at once - that excess is the whole point of scrolling.
A consumer applies offset however its own rendering model wants it. Portal::Forma::LayoutCursor folds it directly into placed bounds (CPU reflow, always hit-test-correct by construction, since the same value that moved the geometry is available to move the hit region too). A buffer wanting to shift many vertices at once without a per-element CPU reflow can instead derive a ViewTransform via scroll_view_transform() and skip that per-element work, at the cost of needing to remap hit-test coordinates by the same offset itself: nothing does that remapping automatically, so a GPU-only shift and CPU hit-testing will disagree the moment offset is nonzero unless something closes that loop.
Definition at line 60 of file ScrollState.hpp.