|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
| Scrollable & MayaFlux::Portal::Forma::Scrollable::track | ( | Layer & | layer, |
| uint32_t | id, | ||
| Kinesis::AABB2D | base_bounds, | ||
| std::function< void(Kinesis::AABB2D)> | reposition, | ||
| const FormaTarget & | clip_buf = {} |
||
| ) |
Register an element for scroll reflow.
Expands scroll->content_bounds to include base_bounds, so the clamp in scroll_by() always reflects everything tracked so far - no manual content-height bookkeeping needed. On every scroll, this element's bounds_hint is updated to base_bounds.translated(offset) and reposition is called with that same shifted region: reposition owns whatever resubmission its own content needs (a raw buffer resubmit, rebuilding a Mapped<T>'s geometry, anything). Scrollable does not inspect or constrain what kind of content id is.
base_bounds is normalized against the current offset before it is stored, so it is always safe to pass cursor_out.advance()'s return directly - that return is already shifted by whatever offset is live right now (that is the whole point of LayoutCursor::bind_scroll: an element placed after scrolling already happened lands in the right spot immediately). Without this normalization an element tracked while scrolled would have that offset baked into its anchor and drift further out of place on every scroll after.
| layer | Layer both the viewport and id were registered on. relate()s id under viewport_id so a cascading Layer::remove(viewport_id) tears this element down too - no separate tracked-ids bookkeeping needed. |
| id | Element id, already registered on the same Layer place() used. |
| base_bounds | This element's current on-screen NDC bounds - the direct return of cursor_out.advance(), scrolled or not. |
| reposition | Called with the scrolled bounds on every scroll. |
| clip_buf | Optional. When given, Kinesis::Scissor::from(viewport_bounds) is set on its render processor immediately, so the element is clipped to the viewport from the start. |
Definition at line 98 of file Scrollable.cpp.
References MayaFlux::Kinesis::Scissor::from(), MayaFlux::Buffers::VKBuffer::get_render_processor(), m_indicator, m_tracked, MayaFlux::Kinesis::AABB2D::max, MayaFlux::Kinesis::AABB2D::min, MayaFlux::Portal::Forma::Layer::relate(), scroll, MayaFlux::Portal::Forma::Layer::set_clip(), MayaFlux::Kinesis::AABB2D::translated(), viewport_bounds, and viewport_id.
Referenced by indicator(), and MayaFlux::Portal::Forma::TextField::scrollable().
Here is the call graph for this function:
Here is the caller graph for this function: