1use gizmo_math::{Vec2, Vec4};
2
3#[derive(Clone, Debug, PartialEq)]
4pub struct Style(pub taffy::style::Style);
5
6unsafe impl Send for Style {}
7unsafe impl Sync for Style {}
8
9impl Default for Style {
10 fn default() -> Self {
11 Self(taffy::style::Style::default())
12 }
13}
14
15impl std::ops::Deref for Style {
16 type Target = taffy::style::Style;
17
18 fn deref(&self) -> &Self::Target {
19 &self.0
20 }
21}
22
23impl std::ops::DerefMut for Style {
24 fn deref_mut(&mut self) -> &mut Self::Target {
25 &mut self.0
26 }
27}
28
29#[derive(Clone, Debug, PartialEq)]
30pub struct Node {
31 pub size: Vec2,
32 pub position: Vec2,
33}
34
35impl Default for Node {
36 fn default() -> Self {
37 Self {
38 size: Vec2::ZERO,
39 position: Vec2::ZERO,
40 }
41 }
42}
43
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum Interaction {
46 None,
47 Hovered,
48 Pressed,
49}
50
51impl Default for Interaction {
52 fn default() -> Self {
53 Interaction::None
54 }
55}
56
57#[derive(Clone, Debug, PartialEq)]
58pub struct BackgroundColor(pub Vec4);
59
60impl Default for BackgroundColor {
61 fn default() -> Self {
62 Self(Vec4::new(1.0, 1.0, 1.0, 1.0))
63 }
64}
65
66#[derive(Clone, Copy, Debug, PartialEq, Eq)]
68pub struct UiRoot;
69gizmo_core::impl_component!(Style, Node, Interaction, BackgroundColor, UiRoot);