|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
A clipped, scroll-offset viewport over content taller than it. More...
#include <Scrollable.hpp>
Collaboration diagram for MayaFlux::Portal::Forma::Scrollable:Public Member Functions | |
| Scrollable & | background_color (glm::vec3 c) |
| Kinesis::AABB2D | bounds () const noexcept |
| Viewport region, satisfying Kinesis::HasBounds. | |
| MAYAFLUX_API Scrollable & | indicator (Surface &surface, Mapped< glm::vec2 > el, Kinesis::AABB2D track) |
| Attach a caller-built element as a live, draggable scroll indicator. | |
| MAYAFLUX_API Scrollable & | place (FormaTarget in_buf, Surface &surface, Kinesis::AABB2D viewport) |
| Register the viewport element, wire wheel scrolling, and populate scroll, offset, buf, and cursor_out. | |
| MAYAFLUX_API void | scroll_by (Layer &layer, glm::vec2 delta) |
| Apply a scroll delta and reflow every tracked element. | |
| MAYAFLUX_API 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. | |
| MAYAFLUX_API std::function< void(uint32_t, glm::vec2, double, double)> | wheel_handler (Surface &surface) const |
| A self-contained wheel-scroll handler bound to this Scrollable's own state. | |
| Scrollable & | wheel_speed (float s) |
Public Attributes | |
| FormaTarget | buf |
| FormaBuffer backing the viewport background. Valid after place(). | |
| LayoutCursor | cursor_out |
| Cursor scoped to the viewport, bound to offset. Valid after place(). | |
| glm::vec3 | m_background { 0.08F, 0.08F, 0.1F } |
| Background fill color. Default: glm::vec3(0.08F, 0.08F, 0.1F). | |
| float | m_wheel_speed { 0.05F } |
| Content-space units scrolled per wheel tick. Default: 0.05F. | |
| std::shared_ptr< MappedState< glm::vec2 > > | offset |
| Reactive mirror of scroll->offset, bound into cursor_out. Valid after place(). | |
| std::shared_ptr< Kinesis::ScrollState > | scroll |
| Clamped scroll offset and content/viewport extents. Valid after place(). | |
| Kinesis::AABB2D | viewport_bounds {} |
| NDC region occupied by the viewport. Valid after place(). | |
| uint32_t | viewport_id {} |
| Element id of the viewport background. Valid after place(). | |
Private Attributes | |
| std::shared_ptr< Mapped< glm::vec2 > > | m_indicator |
| std::shared_ptr< std::vector< Tracked > > | m_tracked |
A clipped, scroll-offset viewport over content taller than it.
Before place() is called, the struct carries only configuration. After place(), viewport_id, scroll, offset, buf, and cursor_out are populated. This mirrors the Element/Collapsible pattern: configure with setters, register with a single explicit call.
Scrollable owns a background/hit-test element sized to the viewport and a LayoutCursor (cursor_out) scoped to that viewport, already bound to the live scroll offset via LayoutCursor::bind_scroll, so content placed through it lands at the correct on-screen position immediately, scrolled or not. It does not own or know what kind of content is placed inside it: track() registers an element id plus the caller's own reposition callback, invoked with that element's scrolled bounds on every scroll. This is the same shape as Collapsible::attach(): Scrollable moves bounds and asks the caller's callback to keep visuals in sync, it does not reach into arbitrary geometry functions to do that itself. indicator() follows the same principle for a scroll readout: Scrollable computes the two numbers (position, extent) and drives sync() on the caller's own element, but draws nothing itself.
Wheel input over the viewport is wired by place() as the default trigger, but scroll_by() is a plain method: any other input source (a dragged indicator, a key, MIDI, anything) can drive scrolling by calling it directly, with no dependency on Context::on_scroll at all.
Definition at line 75 of file Scrollable.hpp.