Skip to content

Commit

Permalink
monitors: adjust text offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Jun 6, 2024
1 parent 941b6c4 commit 76a0480
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions monitors/src/frontend/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,15 @@ pub fn drawing_callback(
context.set_source_color(&selected_text_color);
}
// define text to be scaled with monitor size
let size = (1.0 * (width / 10) as f64 ).clamp(10.0, 25.0);
let size = (1.0 * (width / 10) as f64).clamp(12.0, 18.0);
let gap = size;
const TOP_GAP: f64 = 6.0;
context.set_font_size(size);
context.move_to((offset_x + 10) as f64, (offset_y + 25) as f64);
context.move_to((offset_x + 10) as f64, offset_y as f64 + gap + TOP_GAP);
context
.show_text(&monitor.name.clone())
.expect("Could not draw text");
context.move_to((offset_x + 10) as f64, (offset_y + 45) as f64);
context.move_to((offset_x + 10) as f64, offset_y as f64 + gap * 2.0 + TOP_GAP);
if monitor.enabled {
context
.show_text(&(monitor.size.0.to_string() + ":" + &monitor.size.1.to_string()))
Expand All @@ -708,7 +710,7 @@ pub fn drawing_callback(
context.show_text("disabled").expect("Could not draw text");
}
if monitor.scale != 1.0 {
context.move_to((offset_x + 10) as f64, (offset_y + 65) as f64);
context.move_to((offset_x + 10) as f64, offset_y as f64 + gap * 3.0 + TOP_GAP);
let scale = (monitor.scale * 100.0).round() / 100.0;
context
.show_text(&("scale: ".to_string() + &scale.to_string()))
Expand Down

0 comments on commit 76a0480

Please sign in to comment.