summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer/widget/radio.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-31 21:35:42 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-31 21:38:52 +0100
commit9ab7c47dc7d834ee73bc068f9f34eea4d6946436 (patch)
treeea52e51ffef12208a47fe29299c70095ad403957 /wgpu/src/renderer/widget/radio.rs
parent649d72e7de88e593255075957e65414ed1b4d0d6 (diff)
downloadiced-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/radio.rs')
-rw-r--r--wgpu/src/renderer/widget/radio.rs46
1 files changed, 19 insertions, 27 deletions
diff --git a/wgpu/src/renderer/widget/radio.rs b/wgpu/src/renderer/widget/radio.rs
index 3c00a4c2..aa1dbadc 100644
--- a/wgpu/src/renderer/widget/radio.rs
+++ b/wgpu/src/renderer/widget/radio.rs
@@ -1,5 +1,5 @@
use crate::{Primitive, Renderer};
-use iced_native::{radio, Background, MouseCursor, Rectangle};
+use iced_native::{radio, Background, Color, MouseCursor, Rectangle};
const SIZE: f32 = 28.0;
const DOT_SIZE: f32 = SIZE / 2.0;
@@ -16,30 +16,20 @@ impl radio::Renderer for Renderer {
is_mouse_over: bool,
(label, _): Self::Output,
) -> Self::Output {
- let (radio_border, radio_box) = (
- Primitive::Quad {
- bounds,
- background: Background::Color([0.6, 0.6, 0.6].into()),
- border_radius: (SIZE / 2.0) as u16,
- },
- Primitive::Quad {
- bounds: Rectangle {
- x: bounds.x + 1.0,
- y: bounds.y + 1.0,
- width: bounds.width - 2.0,
- height: bounds.height - 2.0,
- },
- background: Background::Color(
- if is_mouse_over {
- [0.90, 0.90, 0.90]
- } else {
- [0.95, 0.95, 0.95]
- }
- .into(),
- ),
- border_radius: (SIZE / 2.0 - 1.0) as u16,
- },
- );
+ let radio = Primitive::Quad {
+ bounds,
+ background: Background::Color(
+ if is_mouse_over {
+ [0.90, 0.90, 0.90]
+ } else {
+ [0.95, 0.95, 0.95]
+ }
+ .into(),
+ ),
+ border_radius: (SIZE / 2.0) as u16,
+ border_width: 1,
+ border_color: Color::from_rgb(0.6, 0.6, 0.6),
+ };
(
Primitive::Group {
@@ -53,11 +43,13 @@ impl radio::Renderer for Renderer {
},
background: Background::Color([0.3, 0.3, 0.3].into()),
border_radius: (DOT_SIZE / 2.0) as u16,
+ border_width: 0,
+ border_color: Color::TRANSPARENT,
};
- vec![radio_border, radio_box, radio_circle, label]
+ vec![radio, radio_circle, label]
} else {
- vec![radio_border, radio_box, label]
+ vec![radio, label]
},
},
if is_mouse_over {