Skip to main content

aetna_core/tree/
defaults.rs

1//! Default values for [`El`].
2//!
3//! Keeping this separate from the field list makes it easier to review
4//! default-policy changes without scanning the whole node surface.
5
6use crate::image::ImageFit;
7use crate::math::MathDisplay;
8use crate::style::StyleProfile;
9
10use super::geometry::{Corners, Sides};
11use super::layout_types::{Align, Axis, Justify, Size};
12use super::node::El;
13use super::semantics::{Kind, Source, SurfaceRole};
14use super::text_types::{FontFamily, FontWeight, TextAlign, TextOverflow, TextRole, TextWrap};
15
16impl Default for El {
17    fn default() -> Self {
18        Self {
19            kind: Kind::Group,
20            style_profile: StyleProfile::TextOnly,
21            key: None,
22            block_pointer: false,
23            hit_overflow: Sides::zero(),
24            focusable: false,
25            focus_ring_placement: Default::default(),
26            always_show_focus_ring: false,
27            selectable: false,
28            selection_source: None,
29            capture_keys: false,
30            alpha_follows_focused_ancestor: false,
31            blink_when_focused: false,
32            state_follows_interactive_ancestor: false,
33            hover_alpha: None,
34            source: Source::default(),
35            axis: Axis::Overlay,
36            gap: 0.0,
37            padding: Sides::zero(),
38            align: Align::Stretch,
39            justify: Justify::Start,
40            width: Size::Hug,
41            height: Size::Hug,
42            component_size: None,
43            metrics_role: None,
44            explicit_width: false,
45            explicit_height: false,
46            explicit_padding: false,
47            explicit_gap: false,
48            explicit_radius: false,
49            explicit_font_family: false,
50            explicit_mono_font_family: false,
51            explicit_mono: false,
52            fill: None,
53            dim_fill: None,
54            stroke: None,
55            stroke_width: 0.0,
56            radius: Corners::ZERO,
57            shadow: 0.0,
58            surface_role: SurfaceRole::None,
59            paint_overflow: Sides::zero(),
60            clip: false,
61            scrollable: false,
62            pin_end: false,
63            arrow_nav_siblings: false,
64            tooltip: None,
65            cursor: None,
66            cursor_pressed: None,
67            shader_override: None,
68            layout_override: None,
69            virtual_items: None,
70            scrollbar: false,
71            text: None,
72            text_color: None,
73            text_align: TextAlign::Start,
74            text_wrap: TextWrap::NoWrap,
75            text_overflow: TextOverflow::Clip,
76            text_role: TextRole::Body,
77            text_max_lines: None,
78            font_size: crate::tokens::TEXT_SM.size,
79            line_height: crate::tokens::TEXT_SM.line_height,
80            font_family: FontFamily::default(),
81            mono_font_family: FontFamily::JetBrainsMono,
82            font_weight: FontWeight::Regular,
83            font_mono: false,
84            text_italic: false,
85            text_bg: None,
86            text_underline: false,
87            text_strikethrough: false,
88            text_link: None,
89            math: None,
90            math_display: MathDisplay::Inline,
91            icon: None,
92            icon_stroke_width: 2.0,
93            image: None,
94            image_tint: None,
95            image_fit: ImageFit::Contain,
96            surface_source: None,
97            surface_alpha: crate::surface::SurfaceAlpha::Premultiplied,
98            surface_fit: ImageFit::Fill,
99            surface_transform: crate::affine::Affine2::IDENTITY,
100            vector_source: None,
101            vector_render_mode: crate::vector::VectorRenderMode::Painted,
102            children: Vec::new(),
103            opacity: 1.0,
104            translate: (0.0, 0.0),
105            scale: 1.0,
106            animate: None,
107            redraw_within: None,
108            computed_id: String::new(),
109        }
110    }
111}