layout: Unhardcode button and row spacing values

They are specified by each layout now
This commit is contained in:
Dorota Czaplejewicz
2019-09-25 18:43:59 +00:00
parent de43d67638
commit 4c0f23c5c1
10 changed files with 61 additions and 12 deletions

View File

@ -170,6 +170,8 @@ fn load_layout_with_fallback(
#[derive(Debug, Deserialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct Layout {
row_spacing: f64,
button_spacing: f64,
bounds: Bounds,
views: HashMap<String, Vec<ButtonIds>>,
#[serde(default)]
@ -302,6 +304,10 @@ impl Layout {
width: self.bounds.width,
height: self.bounds.height,
},
spacing: ::layout::Spacing {
row: self.row_spacing,
button: self.button_spacing,
},
rows: view.iter().map(|row| {
Box::new(::layout::Row {
angle: 0,
@ -499,6 +505,8 @@ mod tests {
PathBuf::from("tests/layout.yaml")
).unwrap(),
Layout {
row_spacing: 0f64,
button_spacing: 0f64,
bounds: Bounds { x: 0f64, y: 0f64, width: 0f64, height: 0f64 },
views: hashmap!(
"base".into() => vec!("test".into()),