Skip to main content

yew_virtual/core/
scroll_direction.rs

1/// Direction of virtualization scrolling.
2///
3/// Determines whether the virtualizer measures items along the vertical
4/// or horizontal axis. This affects how scroll positions, item sizes,
5/// and container dimensions are interpreted by the engine.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum ScrollDirection {
8    /// Virtualize items along the vertical axis.
9    ///
10    /// Item sizes represent heights and scroll position tracks
11    /// vertical offset within the container.
12    Vertical,
13
14    /// Virtualize items along the horizontal axis.
15    ///
16    /// Item sizes represent widths and scroll position tracks
17    /// horizontal offset within the container.
18    Horizontal,
19}
20
21impl Default for ScrollDirection {
22    /// Returns the default scroll direction.
23    ///
24    /// # Returns
25    ///
26    /// - `ScrollDirection::Vertical`: The default direction.
27    fn default() -> Self {
28        // Default to vertical scrolling as it is the most common use case.
29        Self::Vertical
30    }
31}