Skip to content

Commit 50161bc

Browse files
committed
fix: maintain center position
1 parent 4eebb62 commit 50161bc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/convert/svg.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,15 @@ impl SvgBuilder {
207207
}
208208

209209
let mut placed_coord_x = (self.margin * 2 + n) as f64 - border_size;
210-
placed_coord_x = (placed_coord_x / 2f64).ceil();
210+
211+
// Adjust for non-integer initial x coordinates so as not to partially cover bits by rounding down.
212+
if placed_coord_x % 2f64 != 0f64 {
213+
placed_coord_x += 1f64;
214+
border_size -= 1f64;
215+
}
216+
217+
placed_coord_x = placed_coord_x / 2f64;
218+
211219
let mut placed_coord = (placed_coord_x, placed_coord_x);
212220

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

0 commit comments

Comments
 (0)