mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2025-01-19 04:14:31 +00:00
fix: crash windows at startup, apply custom style to all dark/light theme
This commit is contained in:
parent
2c9187c29d
commit
b57fcb7207
1 changed files with 42 additions and 42 deletions
|
@ -26,7 +26,7 @@ use std::time::Instant;
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub fn init_text_styles(ctx: &egui::Context, width: f32, pixels_per_point: f32) {
|
pub fn init_text_styles(ctx: &egui::Context, width: f32, pixels_per_point: f32) {
|
||||||
let scale = width / 35.5;
|
let scale = width / 35.5;
|
||||||
let mut style = (*ctx.style()).clone();
|
ctx.all_styles_mut(|style| {
|
||||||
style.text_styles = [
|
style.text_styles = [
|
||||||
(Small, FontId::new(scale / 3.0, egui::FontFamily::Monospace)),
|
(Small, FontId::new(scale / 3.0, egui::FontFamily::Monospace)),
|
||||||
(Body, FontId::new(scale / 2.0, egui::FontFamily::Monospace)),
|
(Body, FontId::new(scale / 2.0, egui::FontFamily::Monospace)),
|
||||||
|
@ -67,7 +67,7 @@ pub fn init_text_styles(ctx: &egui::Context, width: f32, pixels_per_point: f32)
|
||||||
bar_width: width / 150.0,
|
bar_width: width / 150.0,
|
||||||
..egui::style::ScrollStyle::solid()
|
..egui::style::ScrollStyle::solid()
|
||||||
};
|
};
|
||||||
ctx.set_style(style);
|
});
|
||||||
// Make sure scale f32 is a regular number.
|
// Make sure scale f32 is a regular number.
|
||||||
let pixels_per_point = clamp_scale(pixels_per_point);
|
let pixels_per_point = clamp_scale(pixels_per_point);
|
||||||
ctx.set_pixels_per_point(pixels_per_point);
|
ctx.set_pixels_per_point(pixels_per_point);
|
||||||
|
|
Loading…
Reference in a new issue