Move font size adjustment code to the theme crate
This commit is contained in:
parent
258723566f
commit
42eca3048f
10 changed files with 69 additions and 56 deletions
|
@ -1,19 +0,0 @@
|
|||
use gpui::AppContext;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FontSizeDelta(pub f32);
|
||||
|
||||
pub fn adjust_font_size_delta(cx: &mut AppContext, f: fn(&mut f32, cx: &mut AppContext)) {
|
||||
cx.update_default_global::<FontSizeDelta, _, _>(|size, cx| {
|
||||
f(&mut size.0, cx);
|
||||
});
|
||||
cx.refresh_windows();
|
||||
}
|
||||
|
||||
pub fn font_size_for_setting(size: f32, cx: &AppContext) -> f32 {
|
||||
if cx.has_global::<FontSizeDelta>() {
|
||||
size + cx.global::<FontSizeDelta>().0
|
||||
} else {
|
||||
size
|
||||
}
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
mod font_size;
|
||||
mod keymap_file;
|
||||
mod settings_file;
|
||||
mod settings_store;
|
||||
|
||||
use std::{borrow::Cow, str};
|
||||
|
||||
pub use font_size::{adjust_font_size_delta, font_size_for_setting};
|
||||
use gpui::AssetSource;
|
||||
pub use keymap_file::{keymap_file_json_schema, KeymapFileContent};
|
||||
pub use settings_file::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue