Skip to content

Commit

Permalink
fix: non integer image position
Browse files Browse the repository at this point in the history
fix: maintain center position
  • Loading branch information
Adam-Alj authored and erwanvivien committed Nov 26, 2024
1 parent df65c97 commit f4aafcb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/convert/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,15 @@ impl SvgBuilder {
}

let mut placed_coord_x = (self.margin * 2 + n) as f64 - border_size;
placed_coord_x /= 2f64;

// Adjust for non-integer initial x coordinates so as not to partially cover bits by rounding down.
if placed_coord_x % 2f64 != 0f64 {
placed_coord_x += 1f64;
border_size -= 1f64;
}

placed_coord_x = placed_coord_x / 2f64;

let mut placed_coord = (placed_coord_x, placed_coord_x);

if let Some((x, y)) = self.image_position {
Expand Down

0 comments on commit f4aafcb

Please sign in to comment.