Skip to main content

scroll_at

Function scroll_at 

Source
pub fn scroll_at(
    layout: &LayoutNode,
    info: &mut InfoNode,
    viewport: (f32, f32),
    x: f32,
    y: f32,
    dx: f32,
    dy: f32,
) -> Option<u32>
Expand description

Scrolls the innermost scrollable container under (x, y) by (dx, dy).

Mirrors hit_test: boxes are tested front-to-back and children are visited before the node itself, so the innermost container wins. Only nodes whose NodeKind::Container / NodeKind::Custom flags enable scrolling for an axis are scrolled, clamped to the scrollable range (children_box extent minus the visible content_box).

Returns Some(dom_id) when any scroll offset actually changed, where dom_id names the scrollable container that absorbed the scroll. The value is NO_SCROLL_DOM_ID when the scrolled container had no snapshot dom id (used to trigger a redraw without dispatching a scroll event); None when nothing scrolled, so a caller can chain the wheel event to an ancestor (e.g. the root).