Skip to main content

yew_virtual/core/
rect.rs

1/// Dimensions of a scroll container or viewport.
2///
3/// Represents the width and height of a rectangular area, used
4/// for tracking scroll container dimensions and initial rect
5/// configuration.
6#[derive(Debug, Clone, Copy, PartialEq)]
7pub struct Rect {
8    /// The width of the rectangle in pixels.
9    pub width: f64,
10
11    /// The height of the rectangle in pixels.
12    pub height: f64,
13}
14
15impl Default for Rect {
16    /// Returns a zero-sized rectangle.
17    ///
18    /// # Returns
19    ///
20    /// - `Rect`: A rectangle with zero width and height.
21    fn default() -> Self {
22        // Default to zero dimensions.
23        Self {
24            width: 0.0,
25            height: 0.0,
26        }
27    }
28}