Skip to main content

euv_ui/hook/use_scroll/
struct.rs

1use super::*;
2
3/// Reactive state for the window's scroll position.
4///
5/// The handle carries the horizontal and vertical scroll offsets and the
6/// teardown that removes the window listener.
7///
8/// The offsets are `Signal<f64>`: a render closure that reads them
9/// re-renders when the page scrolls.
10#[derive(Clone, CustomDebug, Data)]
11pub struct UseScroll {
12    /// The horizontal scroll offset in CSS pixels.
13    #[get(type(copy))]
14    pub x: Signal<f64>,
15    /// The vertical scroll offset in CSS pixels.
16    #[get(type(copy))]
17    pub y: Signal<f64>,
18    /// The teardown that removes the window listener.
19    #[get(pub(crate))]
20    #[debug(skip)]
21    pub(crate) teardown: Teardown,
22}