Skip to content

Commit da2b7e2

Browse files
authored
Add option to hide input bar (#185)
1 parent b5e19cb commit da2b7e2

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Features
44

55
- Support some actions with pointer (e.g mouse).
6+
- Add flag to hide input bar.
67

78
## Changes
89

‎src/config.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ impl Config {
6868
#[derive(Defaults, Deserialize)]
6969
#[serde(default)]
7070
struct InputText {
71+
hide: bool,
7172
font: Option<String>,
7273
font_size: Option<u16>,
7374
bg_color: Option<Color>,

‎src/config/params.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ impl<'a> From<&'a Config> for InputTextParams<'a> {
2929
.unwrap_or(DEFAULT_FONT_COLOR);
3030

3131
InputTextParams {
32+
hide: config.input_text.hide,
3233
font: select_conf!(config, input_text, font)
3334
.map(font_by_name)
3435
.unwrap_or_else(default_font),

‎src/draw/input_text.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::style::{Margin, Padding, Radius};
66
use crate::Color;
77

88
pub struct Params<'a> {
9+
pub hide: bool,
910
pub font: Font,
1011
pub font_size: u16,
1112
pub bg_color: Color,
@@ -39,6 +40,13 @@ impl<'a> InputText<'a> {
3940

4041
impl<'a> Drawable for InputText<'a> {
4142
fn draw(self, dt: &mut DrawTarget<'_>, scale: u16, space: Space, point: Point) -> Space {
43+
if self.params.hide {
44+
return Space {
45+
width: 0.,
46+
height: 0.,
47+
};
48+
}
49+
4250
let font_size = f32::from(self.params.font_size * scale);
4351

4452
let mut padding = &self.params.padding * f32::from(scale);

0 commit comments

Comments
 (0)