Skip to content

Commit

Permalink
add round radius for textbox
Browse files Browse the repository at this point in the history
  • Loading branch information
msparkles committed Jul 3, 2024
1 parent 2aac6d1 commit e9a4156
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/yakui-widgets/src/widgets/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct TextBox {
pub style: TextStyle,
pub padding: Pad,
pub fill: Option<Color>,
pub radius: f32,

/// Whether or not enter triggers a loss of focus and if shift would be needed to override that
pub inline_edit: bool,
Expand All @@ -51,6 +52,7 @@ impl TextBox {
style: TextStyle::label(),
padding: Pad::all(8.0),
fill: Some(colors::BACKGROUND_3),
radius: 6.0,

inline_edit: true,
multiline: false,
Expand Down Expand Up @@ -268,7 +270,7 @@ impl Widget for TextBoxWidget {
let fonts = ctx.dom.get_global_or_init(Fonts::default);
fonts.with_system(|font_system| {
if let Some(fill_color) = self.props.fill {
let mut bg = RoundedRectangle::new(layout_node.rect, 6.0);
let mut bg = RoundedRectangle::new(layout_node.rect, self.props.radius);
bg.color = fill_color;
bg.add(ctx.paint);
}
Expand Down

0 comments on commit e9a4156

Please sign in to comment.