Skip to main content

Module scroll

Module scroll 

Source
Expand description

Driving a scrolling container (widget::scroll_view()) from the raw UI events a Yog screen receives (scroll:DY, click:X:Y, drag:X:Y, release:X:Y).

ⓘ
static LIST: Mutex<ScrollState> = Mutex::new(ScrollState::new());

// render: feed the offset into the tree
root.find_mut("list").unwrap().style.scroll_y = LIST.lock().unwrap().offset;

// events: with the last frame's layout node of "list"
if LIST.lock().unwrap().handle(event, node, 24.0) { return; }

Structs§

ScrollState
Scroll offset plus scrollbar-drag state of one scrolling container.