Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Features

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

## Changes

Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl Config {
#[derive(Defaults, Deserialize)]
#[serde(default)]
struct InputText {
hide: bool,
font: Option<String>,
font_size: Option<u16>,
bg_color: Option<Color>,
Expand Down
1 change: 1 addition & 0 deletions src/config/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 8 additions & 0 deletions src/draw/input_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
Loading