figma_schema/layout_constraint.rs
1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Deserialize, Serialize)]
4#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
5#[typeshare::typeshare]
6pub enum LayoutConstraintVertical {
7 /// Node is laid out relative to top of the containing frame
8 Top,
9 /// Node is laid out relative to bottom of the containing frame
10 Bottom,
11 /// Node is vertically centered relative to containing frame
12 Center,
13 /// Both top and bottom of node are constrained relative to containing frame (node stretches with frame)
14 TopBottom,
15 /// Node scales vertically with containing frame
16 Scale,
17}
18
19#[derive(Debug, Deserialize, Serialize)]
20#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
21#[typeshare::typeshare]
22pub enum LayoutConstraintHorizontal {
23 /// Node is laid out relative to left of the containing frame
24 Left,
25 /// Node is laid out relative to right of the containing frame
26 Right,
27 /// Node is horizontally centered relative to containing frame
28 Center,
29 /// Both left and right of node are constrained relative to containing frame (node stretches with frame)
30 LeftRight,
31 /// Node scales horizontally with containing frame
32 Scale,
33}
34
35/// Layout constraint relative to containing Frame
36#[derive(Debug, Deserialize, Serialize)]
37#[typeshare::typeshare]
38pub struct LayoutConstraint {
39 pub vertical: LayoutConstraintVertical,
40 pub horizontal: LayoutConstraintHorizontal,
41}