diff options
author | 2019-12-31 21:35:42 +0100 | |
---|---|---|
committer | 2019-12-31 21:38:52 +0100 | |
commit | 9ab7c47dc7d834ee73bc068f9f34eea4d6946436 (patch) | |
tree | ea52e51ffef12208a47fe29299c70095ad403957 /wgpu/src/renderer/widget/text_input.rs | |
parent | 649d72e7de88e593255075957e65414ed1b4d0d6 (diff) | |
download | iced-9ab7c47dc7d834ee73bc068f9f34eea4d6946436.tar.gz iced-9ab7c47dc7d834ee73bc068f9f34eea4d6946436.tar.bz2 iced-9ab7c47dc7d834ee73bc068f9f34eea4d6946436.zip |
Add `border_width` and `border_color` to `Quad`
Diffstat (limited to 'wgpu/src/renderer/widget/text_input.rs')
-rw-r--r-- | wgpu/src/renderer/widget/text_input.rs | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/wgpu/src/renderer/widget/text_input.rs b/wgpu/src/renderer/widget/text_input.rs index 929f94db..cf3a31ab 100644 --- a/wgpu/src/renderer/widget/text_input.rs +++ b/wgpu/src/renderer/widget/text_input.rs @@ -64,28 +64,17 @@ impl text_input::Renderer for Renderer { ) -> Self::Output { let is_mouse_over = bounds.contains(cursor_position); - let border = Primitive::Quad { - bounds, - background: Background::Color( - if is_mouse_over || state.is_focused() { - [0.5, 0.5, 0.5] - } else { - [0.7, 0.7, 0.7] - } - .into(), - ), - border_radius: 5, - }; - let input = Primitive::Quad { - bounds: Rectangle { - x: bounds.x + 1.0, - y: bounds.y + 1.0, - width: bounds.width - 2.0, - height: bounds.height - 2.0, - }, + bounds, background: Background::Color(Color::WHITE), - border_radius: 4, + border_radius: 5, + border_width: 1, + border_color: if is_mouse_over || state.is_focused() { + [0.5, 0.5, 0.5] + } else { + [0.7, 0.7, 0.7] + } + .into(), }; let text = value.to_string(); @@ -130,6 +119,8 @@ impl text_input::Renderer for Renderer { }, background: Background::Color(Color::BLACK), border_radius: 0, + border_width: 0, + border_color: Color::TRANSPARENT, }; ( @@ -150,7 +141,7 @@ impl text_input::Renderer for Renderer { ( Primitive::Group { - primitives: vec![border, input, contents], + primitives: vec![input, contents], }, if is_mouse_over { MouseCursor::Text |