1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Figma API
*
* This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api). Note: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).
*
* The version of the OpenAPI document: 0.31.0
* Contact: support@figma.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// LayoutGrid : Guides to align and place objects within a frames.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LayoutGrid {
/// Orientation of the grid as a string enum - `COLUMNS`: Vertical grid - `ROWS`: Horizontal grid - `GRID`: Square grid
#[serde(rename = "pattern")]
pub pattern: Pattern,
/// Width of column grid or height of row grid or square grid spacing.
#[serde(rename = "sectionSize")]
pub section_size: f64,
/// Is the grid currently visible?
#[serde(rename = "visible")]
pub visible: bool,
/// Color of the grid
#[serde(rename = "color")]
pub color: Box<models::Rgba>,
/// Positioning of grid as a string enum - `MIN`: Grid starts at the left or top of the frame - `MAX`: Grid starts at the right or bottom of the frame - `STRETCH`: Grid is stretched to fit the frame - `CENTER`: Grid is center aligned
#[serde(rename = "alignment")]
pub alignment: Alignment,
/// Spacing in between columns and rows
#[serde(rename = "gutterSize")]
pub gutter_size: f64,
/// Spacing before the first column or row
#[serde(rename = "offset")]
pub offset: f64,
/// Number of columns or rows
#[serde(rename = "count")]
pub count: f64,
#[serde(rename = "boundVariables", skip_serializing_if = "Option::is_none")]
pub bound_variables: Option<Box<models::LayoutGridBoundVariables>>,
}
impl LayoutGrid {
/// Guides to align and place objects within a frames.
pub fn new(pattern: Pattern, section_size: f64, visible: bool, color: models::Rgba, alignment: Alignment, gutter_size: f64, offset: f64, count: f64) -> LayoutGrid {
LayoutGrid {
pattern,
section_size,
visible,
color: Box::new(color),
alignment,
gutter_size,
offset,
count,
bound_variables: None,
}
}
}
/// Orientation of the grid as a string enum - `COLUMNS`: Vertical grid - `ROWS`: Horizontal grid - `GRID`: Square grid
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Pattern {
#[serde(rename = "COLUMNS")]
Columns,
#[serde(rename = "ROWS")]
Rows,
#[serde(rename = "GRID")]
Grid,
}
impl Default for Pattern {
fn default() -> Pattern {
Self::Columns
}
}
/// Positioning of grid as a string enum - `MIN`: Grid starts at the left or top of the frame - `MAX`: Grid starts at the right or bottom of the frame - `STRETCH`: Grid is stretched to fit the frame - `CENTER`: Grid is center aligned
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Alignment {
#[serde(rename = "MIN")]
Min,
#[serde(rename = "MAX")]
Max,
#[serde(rename = "STRETCH")]
Stretch,
#[serde(rename = "CENTER")]
Center,
}
impl Default for Alignment {
fn default() -> Alignment {
Self::Min
}
}