inkanim_types/ink/widget/
layout.rs1use serde::{Deserialize, Serialize};
2
3use crate::Vector2;
4
5#[allow(non_camel_case_types)]
6#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
7pub enum inkEAnchor {
8 #[default]
9 TopLeft = 0,
10 TopCenter = 1,
11 TopRight = 2,
12 CenterLeft = 3,
13 Centered = 4,
14 CenterRight = 5,
15 BottomLeft = 6,
16 BottomCenter = 7,
17 BottomRight = 8,
18 TopFillHorizontaly = 9,
19 CenterFillHorizontaly = 10,
20 BottomFillHorizontaly = 11,
21 LeftFillVerticaly = 12,
22 CenterFillVerticaly = 13,
23 RightFillVerticaly = 14,
24 Fill = 15,
25}
26
27#[allow(non_camel_case_types)]
28#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
29pub enum inkEHorizontalAlign {
30 #[default]
31 Fill = 0,
32 Left = 1,
33 Center = 2,
34 Right = 3,
35}
36
37#[allow(non_camel_case_types)]
38#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
39pub enum inkEVerticalAlign {
40 #[default]
41 Fill = 0,
42 Top = 1,
43 Center = 2,
44 Bottom = 3,
45}
46
47#[allow(non_camel_case_types)]
48#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
49pub struct inkUITransform {
50 pub translation: Vector2,
51 pub scale: Scale,
52 pub shear: Vector2,
53 pub rotation: f32,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
57#[serde(transparent)]
58pub struct Scale(Vector2);
59impl Default for Scale {
60 fn default() -> Self {
61 Self(Vector2 { x: 1., y: 1. })
62 }
63}
64
65#[allow(non_camel_case_types)]
66#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
67pub enum textJustificationType {
68 #[default]
69 Left = 0,
70 Center = 1,
71 Right = 2,
72}
73
74#[allow(non_camel_case_types)]
75#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
76#[serde(tag = "$type")]
77pub struct inkMargin {
78 pub left: f32,
79 pub top: f32,
80 pub right: f32,
81 pub bottom: f32,
82}
83
84#[allow(non_camel_case_types)]
85#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
86#[serde(tag = "$type", rename_all = "camelCase")]
87pub struct inkWidgetLayout {
88 pub anchor: inkEAnchor,
89 pub anchor_point: Vector2,
90 pub padding: inkMargin,
91 pub margin: inkMargin,
92 #[serde(rename = "HAlign")]
93 pub h_align: inkEHorizontalAlign,
94}
95
96#[allow(non_camel_case_types)]
97#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
98pub enum inkEChildOrder {
99 #[default]
100 Forward = 0,
101 Backward = 1,
102}