pub fn dispatch_scroll(
stack: &ModalStack,
scroll_surfaces: &[ScrollSurface],
position: Point,
delta: ScrollDelta,
) -> Vec<UiEvent>Expand description
Translate a raw scroll-wheel event into a Vec<UiEvent>, consulting
the modal stack first, then the registered scroll surfaces.
§Scroll delta sign convention
Positive delta.y = scroll content up (toward the top of the
document). Backends normalise their native direction before
constructing ScrollDelta — see ScrollDelta for the
canonical definition. Compose helpers ([TreeController],
[SidebarSystem]) consume the delta directly without per-call-site
negation.
§Returns
Three cases:
- Scroll landed inside an open modal. Emits
[UiEvent::Scroll { widget: Some(modal_id), delta, position }]. The app routes to the modal’s inner scroll handler. - Modal(s) open but scroll was outside them. Emits nothing — scroll behind an open modal is swallowed (you can’t scroll the editor while a dialog is up).
- No modal open. Hit-tests
scroll_surfaceslast-to-first (topmost-painted wins). If a surface matches, emits[UiEvent::Scroll { widget: Some(surface_id), delta, position }]. If no surface matches, emits[UiEvent::Scroll { widget: None, delta, position }]for base-layer handling.