diff --git a/CHANGELOG.md b/CHANGELOG.md index fa48f2c..9c55609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Features - Support some actions with pointer (e.g mouse). +- Add flag to hide input bar. ## Changes diff --git a/src/config.rs b/src/config.rs index 7c945b7..4cdb46e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -68,6 +68,7 @@ impl Config { #[derive(Defaults, Deserialize)] #[serde(default)] struct InputText { + hide: bool, font: Option, font_size: Option, bg_color: Option, diff --git a/src/config/params.rs b/src/config/params.rs index ee35ee1..5e2ad3c 100644 --- a/src/config/params.rs +++ b/src/config/params.rs @@ -29,6 +29,7 @@ impl<'a> From<&'a Config> for InputTextParams<'a> { .unwrap_or(DEFAULT_FONT_COLOR); InputTextParams { + hide: config.input_text.hide, font: select_conf!(config, input_text, font) .map(font_by_name) .unwrap_or_else(default_font), diff --git a/src/draw/input_text.rs b/src/draw/input_text.rs index f33554f..527433f 100644 --- a/src/draw/input_text.rs +++ b/src/draw/input_text.rs @@ -6,6 +6,7 @@ use crate::style::{Margin, Padding, Radius}; use crate::Color; pub struct Params<'a> { + pub hide: bool, pub font: Font, pub font_size: u16, pub bg_color: Color, @@ -39,6 +40,13 @@ impl<'a> InputText<'a> { impl<'a> Drawable for InputText<'a> { fn draw(self, dt: &mut DrawTarget<'_>, scale: u16, space: Space, point: Point) -> Space { + if self.params.hide { + return Space { + width: 0., + height: 0., + }; + } + let font_size = f32::from(self.params.font_size * scale); let mut padding = &self.params.padding * f32::from(scale);