Skip to content

Commit

Permalink
fix typo and margin
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirabellensaft committed Jan 25, 2025
1 parent 0a7883e commit fe9bd11
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions sanguine_lib/src/resources/layout/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,24 @@ impl Layout for Grid {
}
LayoutType::VoronoiBased(_) => return Err(Error::LayoutTypeError),
}
let column_width = (parameters.width / columns as i32) - parameters.margin as i32;
let row_height = (parameters.height / rows as i32) - parameters.margin as i32;
let column_width = (parameters.width / columns as i32)
- (parameters.margin as i32 / columns as i32)
- parameters.margin as i32;
let row_height = (parameters.height / rows as i32)
- (parameters.margin as i32 / columns as i32)
- parameters.margin as i32;

let mut fields = Vec::new();

for row in 0..rows {
let mut inner = Vec::new();
for col in 0..columns {
let x = (column_width + parameters.margin) * col as i32;
let y = (row_height + parameters.margin) * row as i32;
let x = parameters.margin + ((column_width + parameters.margin) * col as i32);
let y = parameters.margin + ((row_height + parameters.margin) * row as i32);

let field = Field {
x: x,
y: x,
y: y,
column_width: column_width, // - parameters.margin,
row_height: row_height, // - parameters.margin,
density: Density::Empty,
Expand All @@ -70,7 +75,6 @@ impl Layout for Grid {
y as f32 + (row_height / 2) as f32,
),
};

inner.push(field)
}
fields.push(inner)
Expand Down

0 comments on commit fe9bd11

Please sign in to comment.