summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-14 06:48:12 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-14 06:48:12 +0100
commitaf5ec4941270c832557994d9b4cc70ce5feac911 (patch)
tree7ea832e70007aeef958ac40b525783f590ff2d26 /wgpu
parenta16dab9cf2e27cb933cc91383ca79ba8e188c4c2 (diff)
parentbe5466a0a7ee6a16b5c07e61c9a22068ad8e127f (diff)
downloadiced-af5ec4941270c832557994d9b4cc70ce5feac911.tar.gz
iced-af5ec4941270c832557994d9b4cc70ce5feac911.tar.bz2
iced-af5ec4941270c832557994d9b4cc70ce5feac911.zip
Merge pull request #55 from hecrj/example/edit-todos
Edit and delete todos
Diffstat (limited to '')
-rw-r--r--wgpu/src/renderer/widget/button.rs45
1 files changed, 23 insertions, 22 deletions
diff --git a/wgpu/src/renderer/widget/button.rs b/wgpu/src/renderer/widget/button.rs
index 3d5e42ba..a19c7d86 100644
--- a/wgpu/src/renderer/widget/button.rs
+++ b/wgpu/src/renderer/widget/button.rs
@@ -12,7 +12,7 @@ impl button::Renderer for Renderer {
) -> layout::Node {
let padding = f32::from(button.padding);
let limits = limits
- .min_width(100)
+ .min_width(button.min_width)
.width(button.width)
.height(Length::Shrink)
.pad(padding);
@@ -56,28 +56,29 @@ impl button::Renderer for Renderer {
};
(
- Primitive::Group {
- primitives: vec![
- Primitive::Quad {
- bounds: Rectangle {
- x: bounds.x + 1.0,
- y: bounds.y + shadow_offset,
- ..bounds
+ match button.background {
+ None => content,
+ Some(background) => Primitive::Group {
+ primitives: vec![
+ Primitive::Quad {
+ bounds: Rectangle {
+ x: bounds.x + 1.0,
+ y: bounds.y + shadow_offset,
+ ..bounds
+ },
+ background: Background::Color(
+ [0.0, 0.0, 0.0, 0.5].into(),
+ ),
+ border_radius: button.border_radius,
},
- background: Background::Color(
- [0.0, 0.0, 0.0, 0.5].into(),
- ),
- border_radius: button.border_radius,
- },
- Primitive::Quad {
- bounds,
- background: button.background.unwrap_or(
- Background::Color([0.8, 0.8, 0.8].into()),
- ),
- border_radius: button.border_radius,
- },
- content,
- ],
+ Primitive::Quad {
+ bounds,
+ background,
+ border_radius: button.border_radius,
+ },
+ content,
+ ],
+ },
},
if is_mouse_over {
MouseCursor::Pointer