1use gizmo_math::{Vec2, Vec4};
2
3#[derive(Clone, Debug, PartialEq)]
9#[derive(Default)]
10pub struct Style(pub taffy::style::Style);
11
12unsafe impl Send for Style {}
13unsafe impl Sync for Style {}
14
15
16impl std::ops::Deref for Style {
17 type Target = taffy::style::Style;
18
19 fn deref(&self) -> &Self::Target {
20 &self.0
21 }
22}
23
24impl std::ops::DerefMut for Style {
25 fn deref_mut(&mut self) -> &mut Self::Target {
26 &mut self.0
27 }
28}
29
30#[derive(Clone, Copy, Debug, PartialEq)]
35pub struct Node {
36 pub size: Vec2,
38 pub position: Vec2,
40}
41
42impl Default for Node {
43 fn default() -> Self {
44 Self {
45 size: Vec2::ZERO,
46 position: Vec2::ZERO,
47 }
48 }
49}
50
51#[derive(Clone, Copy, Debug, PartialEq, Eq)]
54#[derive(Default)]
55#[non_exhaustive]
56pub enum Interaction {
57 #[default]
59 None,
60 Hovered,
62 Pressed,
64}
65
66
67#[derive(Clone, Copy, Debug, PartialEq)]
70pub struct BackgroundColor(pub Vec4);
71
72impl Default for BackgroundColor {
73 fn default() -> Self {
74 Self(Vec4::new(1.0, 1.0, 1.0, 1.0))
75 }
76}
77
78#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80pub struct UiRoot;
81gizmo_core::impl_component!(Style, Node, Interaction, BackgroundColor, UiRoot);