Skip to content

Commit 276dc78

Browse files
Merge remote-tracking branch 'kekrby/pixel-shift-space-fix'
2 parents ccd9892 + c423c4f commit 276dc78

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ impl FunctionLayer {
118118
let c = Context::new(&surface).unwrap();
119119
c.translate(DFR_HEIGHT as f64, 0.0);
120120
c.rotate((90.0f64).to_radians());
121-
let button_width = ((DFR_WIDTH - PIXEL_SHIFT_WIDTH_PX as i32) - (BUTTON_SPACING_PX * (self.buttons.len() - 1) as i32)) as f64 / self.buttons.len() as f64;
121+
let pixel_shift_width = if config.enable_pixel_shift { PIXEL_SHIFT_WIDTH_PX } else { 0 };
122+
let button_width = ((DFR_WIDTH - pixel_shift_width as i32) - (BUTTON_SPACING_PX * (self.buttons.len() - 1) as i32)) as f64 / self.buttons.len() as f64;
122123
let radius = 8.0f64;
123124
let bot = (DFR_HEIGHT as f64) * 0.2;
124125
let top = (DFR_HEIGHT as f64) * 0.85;
@@ -129,7 +130,7 @@ impl FunctionLayer {
129130
c.set_font_face(&config.font_face);
130131
c.set_font_size(32.0);
131132
for (i, button) in self.buttons.iter().enumerate() {
132-
let left_edge = (i as f64 * (button_width + BUTTON_SPACING_PX as f64)).floor() + pixel_shift_x + (PIXEL_SHIFT_WIDTH_PX / 2) as f64;
133+
let left_edge = (i as f64 * (button_width + BUTTON_SPACING_PX as f64)).floor() + pixel_shift_x + (pixel_shift_width / 2) as f64;
133134
let color = if active_buttons[i] {
134135
BUTTON_COLOR_ACTIVE
135136
} else if config.show_button_outlines {

0 commit comments

Comments
 (0)