Skip to main content

euv_core/style/length/
struct.rs

1use super::*;
2
3/// Four-sided edge dimensions for margin, padding, and safe-area insets.
4#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
5pub struct Edges {
6    /// Top edge inset in logical pixels.
7    #[get(type(copy))]
8    pub(crate) top: f32,
9    /// Right edge inset in logical pixels.
10    #[get(type(copy))]
11    pub(crate) right: f32,
12    /// Bottom edge inset in logical pixels.
13    #[get(type(copy))]
14    pub(crate) bottom: f32,
15    /// Left edge inset in logical pixels.
16    #[get(type(copy))]
17    pub(crate) left: f32,
18}
19
20/// Per-corner border radius specification in logical pixels.
21#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
22pub struct CornerRadius {
23    /// Top-left corner radius.
24    #[get(type(copy))]
25    pub(crate) top_left: f32,
26    /// Top-right corner radius.
27    #[get(type(copy))]
28    pub(crate) top_right: f32,
29    /// Bottom-right corner radius.
30    #[get(type(copy))]
31    pub(crate) bottom_right: f32,
32    /// Bottom-left corner radius.
33    #[get(type(copy))]
34    pub(crate) bottom_left: f32,
35}
36
37/// 2D point in logical pixels.
38#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
39pub struct Point {
40    /// Horizontal coordinate.
41    #[get(type(copy))]
42    pub(crate) x: f32,
43    /// Vertical coordinate.
44    #[get(type(copy))]
45    pub(crate) y: f32,
46}
47
48/// 2D size in logical pixels.
49#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
50pub struct Size {
51    /// Horizontal width.
52    #[get(type(copy))]
53    pub(crate) width: f32,
54    /// Vertical height.
55    #[get(type(copy))]
56    pub(crate) height: f32,
57}
58
59/// Axis-aligned rectangle in logical pixels.
60#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
61pub struct Rect {
62    /// Left X coordinate.
63    #[get(type(copy))]
64    pub(crate) x: f32,
65    /// Top Y coordinate.
66    #[get(type(copy))]
67    pub(crate) y: f32,
68    /// Width of the rectangle.
69    #[get(type(copy))]
70    pub(crate) width: f32,
71    /// Height of the rectangle.
72    #[get(type(copy))]
73    pub(crate) height: f32,
74}