summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/custom_widget/src/main.rs36
-rw-r--r--examples/game_of_life/src/style.rs18
-rw-r--r--examples/pane_grid/src/main.rs4
-rw-r--r--examples/pokedex/src/main.rs2
-rw-r--r--examples/scrollable/src/style.rs12
-rw-r--r--examples/stopwatch/src/main.rs2
-rw-r--r--examples/styling/src/main.rs36
-rw-r--r--examples/todos/src/main.rs4
-rw-r--r--examples/tour/src/main.rs2
-rw-r--r--graphics/src/layer.rs4
-rw-r--r--graphics/src/overlay/menu.rs6
-rw-r--r--graphics/src/primitive.rs4
-rw-r--r--graphics/src/renderer.rs4
-rw-r--r--graphics/src/widget/button.rs4
-rw-r--r--graphics/src/widget/container.rs2
-rw-r--r--graphics/src/widget/progress_bar.rs4
-rw-r--r--graphics/src/widget/radio.rs6
-rw-r--r--graphics/src/widget/rule.rs4
-rw-r--r--graphics/src/widget/scrollable.rs2
-rw-r--r--graphics/src/widget/slider.rs10
-rw-r--r--graphics/src/widget/text_input.rs8
-rw-r--r--style/src/button.rs12
-rw-r--r--style/src/checkbox.rs8
-rw-r--r--style/src/container.rs12
-rw-r--r--style/src/menu.rs4
-rw-r--r--style/src/pick_list.rs8
-rw-r--r--style/src/progress_bar.rs4
-rw-r--r--style/src/radio.rs4
-rw-r--r--style/src/rule.rs4
-rw-r--r--style/src/scrollable.rs16
-rw-r--r--style/src/slider.rs10
-rw-r--r--style/src/text_input.rs12
32 files changed, 134 insertions, 134 deletions
diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs
index a0003d65..36f468c7 100644
--- a/examples/custom_widget/src/main.rs
+++ b/examples/custom_widget/src/main.rs
@@ -16,11 +16,11 @@ mod circle {
};
pub struct Circle {
- radius: u16,
+ radius: f32,
}
impl Circle {
- pub fn new(radius: u16) -> Self {
+ pub fn new(radius: f32) -> Self {
Self { radius }
}
}
@@ -42,16 +42,13 @@ mod circle {
_renderer: &Renderer<B>,
_limits: &layout::Limits,
) -> layout::Node {
- layout::Node::new(Size::new(
- f32::from(self.radius) * 2.0,
- f32::from(self.radius) * 2.0,
- ))
+ layout::Node::new(Size::new(self.radius * 2.0, self.radius * 2.0))
}
fn hash_layout(&self, state: &mut Hasher) {
use std::hash::Hash;
- self.radius.hash(state);
+ self.radius.to_bits().hash(state);
}
fn draw(
@@ -67,7 +64,7 @@ mod circle {
bounds: layout.bounds(),
background: Background::Color(Color::BLACK),
border_radius: self.radius,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
mouse::Interaction::default(),
@@ -96,7 +93,7 @@ pub fn main() -> iced::Result {
}
struct Example {
- radius: u16,
+ radius: f32,
slider: slider::State,
}
@@ -110,7 +107,7 @@ impl Sandbox for Example {
fn new() -> Self {
Example {
- radius: 50,
+ radius: 50.0,
slider: slider::State::new(),
}
}
@@ -122,7 +119,7 @@ impl Sandbox for Example {
fn update(&mut self, message: Message) {
match message {
Message::RadiusChanged(radius) => {
- self.radius = radius.round() as u16;
+ self.radius = radius;
}
}
}
@@ -134,13 +131,16 @@ impl Sandbox for Example {
.max_width(500)
.align_items(Align::Center)
.push(Circle::new(self.radius))
- .push(Text::new(format!("Radius: {}", self.radius.to_string())))
- .push(Slider::new(
- &mut self.slider,
- 1.0..=100.0,
- f32::from(self.radius),
- Message::RadiusChanged,
- ));
+ .push(Text::new(format!("Radius: {:.2}", self.radius)))
+ .push(
+ Slider::new(
+ &mut self.slider,
+ 1.0..=100.0,
+ self.radius,
+ Message::RadiusChanged,
+ )
+ .step(0.01),
+ );
Container::new(content)
.width(Length::Fill)
diff --git a/examples/game_of_life/src/style.rs b/examples/game_of_life/src/style.rs
index 308ce43c..6605826f 100644
--- a/examples/game_of_life/src/style.rs
+++ b/examples/game_of_life/src/style.rs
@@ -44,7 +44,7 @@ impl button::StyleSheet for Button {
fn active(&self) -> button::Style {
button::Style {
background: Some(Background::Color(ACTIVE)),
- border_radius: 3,
+ border_radius: 3.0,
text_color: Color::WHITE,
..button::Style::default()
}
@@ -60,7 +60,7 @@ impl button::StyleSheet for Button {
fn pressed(&self) -> button::Style {
button::Style {
- border_width: 1,
+ border_width: 1.0,
border_color: Color::WHITE,
..self.hovered()
}
@@ -73,7 +73,7 @@ impl button::StyleSheet for Clear {
fn active(&self) -> button::Style {
button::Style {
background: Some(Background::Color(DESTRUCTIVE)),
- border_radius: 3,
+ border_radius: 3.0,
text_color: Color::WHITE,
..button::Style::default()
}
@@ -92,7 +92,7 @@ impl button::StyleSheet for Clear {
fn pressed(&self) -> button::Style {
button::Style {
- border_width: 1,
+ border_width: 1.0,
border_color: Color::WHITE,
..self.hovered()
}
@@ -106,9 +106,9 @@ impl slider::StyleSheet for Slider {
slider::Style {
rail_colors: (ACTIVE, Color { a: 0.1, ..ACTIVE }),
handle: slider::Handle {
- shape: slider::HandleShape::Circle { radius: 9 },
+ shape: slider::HandleShape::Circle { radius: 9.0 },
color: ACTIVE,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
}
@@ -146,7 +146,7 @@ impl pick_list::StyleSheet for PickList {
pick_list::Menu {
text_color: Color::WHITE,
background: BACKGROUND.into(),
- border_width: 1,
+ border_width: 1.0,
border_color: Color {
a: 0.7,
..Color::BLACK
@@ -164,12 +164,12 @@ impl pick_list::StyleSheet for PickList {
pick_list::Style {
text_color: Color::WHITE,
background: BACKGROUND.into(),
- border_width: 1,
+ border_width: 1.0,
border_color: Color {
a: 0.6,
..Color::BLACK
},
- border_radius: 2,
+ border_radius: 2.0,
icon_size: 0.5,
}
}
diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs
index f986cc8d..3c3256cf 100644
--- a/examples/pane_grid/src/main.rs
+++ b/examples/pane_grid/src/main.rs
@@ -318,7 +318,7 @@ mod style {
fn style(&self) -> container::Style {
container::Style {
background: Some(Background::Color(SURFACE)),
- border_width: 2,
+ border_width: 2.0,
border_color: if self.is_focused {
Color::BLACK
} else {
@@ -346,7 +346,7 @@ mod style {
button::Style {
text_color,
background: background.map(Background::Color),
- border_radius: 5,
+ border_radius: 5.0,
shadow_offset: Vector::new(0.0, 0.0),
..button::Style::default()
}
diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs
index 30674fa0..187e5dee 100644
--- a/examples/pokedex/src/main.rs
+++ b/examples/pokedex/src/main.rs
@@ -251,7 +251,7 @@ mod style {
background: Some(Background::Color(match self {
Button::Primary => Color::from_rgb(0.11, 0.42, 0.87),
})),
- border_radius: 12,
+ border_radius: 12.0,
shadow_offset: Vector::new(1.0, 1.0),
text_color: Color::WHITE,
..button::Style::default()
diff --git a/examples/scrollable/src/style.rs b/examples/scrollable/src/style.rs
index 24d711ac..ae449141 100644
--- a/examples/scrollable/src/style.rs
+++ b/examples/scrollable/src/style.rs
@@ -114,7 +114,7 @@ mod dark {
radio::Style {
background: SURFACE.into(),
dot_color: ACTIVE,
- border_width: 1,
+ border_width: 1.0,
border_color: ACTIVE,
}
}
@@ -137,13 +137,13 @@ mod dark {
..SCROLLBAR
}
.into(),
- border_radius: 2,
- border_width: 0,
+ border_radius: 2.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
scroller: scrollable::Scroller {
color: Color { a: 0.7, ..SCROLLER },
- border_radius: 2,
- border_width: 0,
+ border_radius: 2.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
}
@@ -182,7 +182,7 @@ mod dark {
rule::Style {
color: SURFACE,
width: 2,
- radius: 1,
+ radius: 1.0,
fill_mode: rule::FillMode::Percent(30.0),
}
}
diff --git a/examples/stopwatch/src/main.rs b/examples/stopwatch/src/main.rs
index 5a69aa9a..983cf3e6 100644
--- a/examples/stopwatch/src/main.rs
+++ b/examples/stopwatch/src/main.rs
@@ -161,7 +161,7 @@ mod style {
Button::Secondary => Color::from_rgb(0.5, 0.5, 0.5),
Button::Destructive => Color::from_rgb(0.8, 0.2, 0.2),
})),
- border_radius: 12,
+ border_radius: 12.0,
shadow_offset: Vector::new(1.0, 1.0),
text_color: Color::WHITE,
..button::Style::default()
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index ef302e61..8975fd9a 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -249,7 +249,7 @@ mod style {
fn active(&self) -> button::Style {
button::Style {
background: Color::from_rgb(0.11, 0.42, 0.87).into(),
- border_radius: 12,
+ border_radius: 12.0,
shadow_offset: Vector::new(1.0, 1.0),
text_color: Color::from_rgb8(0xEE, 0xEE, 0xEE),
..button::Style::default()
@@ -315,7 +315,7 @@ mod style {
radio::Style {
background: SURFACE.into(),
dot_color: ACTIVE,
- border_width: 1,
+ border_width: 1.0,
border_color: ACTIVE,
}
}
@@ -334,15 +334,15 @@ mod style {
fn active(&self) -> text_input::Style {
text_input::Style {
background: SURFACE.into(),
- border_radius: 2,
- border_width: 0,
+ border_radius: 2.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
}
}
fn focused(&self) -> text_input::Style {
text_input::Style {
- border_width: 1,
+ border_width: 1.0,
border_color: ACCENT,
..self.active()
}
@@ -350,7 +350,7 @@ mod style {
fn hovered(&self) -> text_input::Style {
text_input::Style {
- border_width: 1,
+ border_width: 1.0,
border_color: Color { a: 0.3, ..ACCENT },
..self.focused()
}
@@ -375,7 +375,7 @@ mod style {
fn active(&self) -> button::Style {
button::Style {
background: ACTIVE.into(),
- border_radius: 3,
+ border_radius: 3.0,
text_color: Color::WHITE,
..button::Style::default()
}
@@ -391,7 +391,7 @@ mod style {
fn pressed(&self) -> button::Style {
button::Style {
- border_width: 1,
+ border_width: 1.0,
border_color: Color::WHITE,
..self.hovered()
}
@@ -404,13 +404,13 @@ mod style {
fn active(&self) -> scrollable::Scrollbar {
scrollable::Scrollbar {
background: SURFACE.into(),
- border_radius: 2,
- border_width: 0,
+ border_radius: 2.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
scroller: scrollable::Scroller {
color: ACTIVE,
- border_radius: 2,
- border_width: 0,
+ border_radius: 2.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
}
@@ -449,9 +449,9 @@ mod style {
slider::Style {
rail_colors: (ACTIVE, Color { a: 0.1, ..ACTIVE }),
handle: slider::Handle {
- shape: slider::HandleShape::Circle { radius: 9 },
+ shape: slider::HandleShape::Circle { radius: 9.0 },
color: ACTIVE,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
}
@@ -489,7 +489,7 @@ mod style {
progress_bar::Style {
background: SURFACE.into(),
bar: ACTIVE.into(),
- border_radius: 10,
+ border_radius: 10.0,
}
}
}
@@ -502,8 +502,8 @@ mod style {
background: if is_checked { ACTIVE } else { SURFACE }
.into(),
checkmark_color: Color::WHITE,
- border_radius: 2,
- border_width: 1,
+ border_radius: 2.0,
+ border_width: 1.0,
border_color: ACTIVE,
}
}
@@ -527,7 +527,7 @@ mod style {
rule::Style {
color: SURFACE,
width: 2,
- radius: 1,
+ radius: 1.0,
fill_mode: rule::FillMode::Padded(15),
}
}
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index f88e9869..ccee2703 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -611,7 +611,7 @@ mod style {
background: Some(Background::Color(
Color::from_rgb(0.2, 0.2, 0.7),
)),
- border_radius: 10,
+ border_radius: 10.0,
text_color: Color::WHITE,
..button::Style::default()
}
@@ -627,7 +627,7 @@ mod style {
background: Some(Background::Color(Color::from_rgb(
0.8, 0.2, 0.2,
))),
- border_radius: 5,
+ border_radius: 5.0,
text_color: Color::WHITE,
shadow_offset: Vector::new(1.0, 1.0),
..button::Style::default()
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index 560d67e2..e8755d39 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -769,7 +769,7 @@ mod style {
Button::Primary => Color::from_rgb(0.11, 0.42, 0.87),
Button::Secondary => Color::from_rgb(0.5, 0.5, 0.5),
})),
- border_radius: 12,
+ border_radius: 12.0,
shadow_offset: Vector::new(1.0, 1.0),
text_color: Color::from_rgb8(0xEE, 0xEE, 0xEE),
..button::Style::default()
diff --git a/graphics/src/layer.rs b/graphics/src/layer.rs
index 6aca738e..038c93ff 100644
--- a/graphics/src/layer.rs
+++ b/graphics/src/layer.rs
@@ -156,8 +156,8 @@ impl<'a> Layer<'a> {
color: match background {
Background::Color(color) => color.into_linear(),
},
- border_radius: *border_radius as f32,
- border_width: *border_width as f32,
+ border_radius: *border_radius,
+ border_width: *border_width,
border_color: border_color.into_linear(),
});
}
diff --git a/graphics/src/overlay/menu.rs b/graphics/src/overlay/menu.rs
index f42c5e3c..ffe998c5 100644
--- a/graphics/src/overlay/menu.rs
+++ b/graphics/src/overlay/menu.rs
@@ -29,7 +29,7 @@ where
background: style.background,
border_color: style.border_color,
border_width: style.border_width,
- border_radius: 0,
+ border_radius: 0.0,
},
primitives,
],
@@ -80,8 +80,8 @@ where
bounds,
background: style.selected_background,
border_color: Color::TRANSPARENT,
- border_width: 0,
- border_radius: 0,
+ border_width: 0.0,
+ border_radius: 0.0,
});
}
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs
index 95dbf7dd..30263bd4 100644
--- a/graphics/src/primitive.rs
+++ b/graphics/src/primitive.rs
@@ -40,9 +40,9 @@ pub enum Primitive {
/// The background of the quad
background: Background,
/// The border radius of the quad
- border_radius: u16,
+ border_radius: f32,
/// The border width of the quad
- border_width: u16,
+ border_width: f32,
/// The border color of the quad
border_color: Color,
},
diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs
index a880e22a..ae5038db 100644
--- a/graphics/src/renderer.rs
+++ b/graphics/src/renderer.rs
@@ -119,8 +119,8 @@ fn explain_layout(
primitives.push(Primitive::Quad {
bounds: layout.bounds(),
background: Background::Color(Color::TRANSPARENT),
- border_radius: 0,
- border_width: 1,
+ border_radius: 0.0,
+ border_width: 1.0,
border_color: [0.6, 0.6, 0.6, 0.5].into(),
});
diff --git a/graphics/src/widget/button.rs b/graphics/src/widget/button.rs
index a1afc940..87581175 100644
--- a/graphics/src/widget/button.rs
+++ b/graphics/src/widget/button.rs
@@ -66,7 +66,7 @@ where
);
(
- if styling.background.is_some() || styling.border_width > 0 {
+ if styling.background.is_some() || styling.border_width > 0.0 {
let background = Primitive::Quad {
bounds,
background: styling
@@ -93,7 +93,7 @@ where
[0.0, 0.0, 0.0, 0.5].into(),
),
border_radius: styling.border_radius,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
};
diff --git a/graphics/src/widget/container.rs b/graphics/src/widget/container.rs
index 4854f589..aae3e1d8 100644
--- a/graphics/src/widget/container.rs
+++ b/graphics/src/widget/container.rs
@@ -62,7 +62,7 @@ pub(crate) fn background(
bounds: Rectangle,
style: &container::Style,
) -> Option<Primitive> {
- if style.background.is_some() || style.border_width > 0 {
+ if style.background.is_some() || style.border_width > 0.0 {
Some(Primitive::Quad {
bounds,
background: style
diff --git a/graphics/src/widget/progress_bar.rs b/graphics/src/widget/progress_bar.rs
index 48acb3c1..c1801a41 100644
--- a/graphics/src/widget/progress_bar.rs
+++ b/graphics/src/widget/progress_bar.rs
@@ -43,7 +43,7 @@ where
bounds: Rectangle { ..bounds },
background: style.background,
border_radius: style.border_radius,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
}],
};
@@ -57,7 +57,7 @@ where
},
background: style.bar,
border_radius: style.border_radius,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
};
diff --git a/graphics/src/widget/radio.rs b/graphics/src/widget/radio.rs
index da41ac47..fd3d8145 100644
--- a/graphics/src/widget/radio.rs
+++ b/graphics/src/widget/radio.rs
@@ -42,7 +42,7 @@ where
let radio = Primitive::Quad {
bounds,
background: style.background,
- border_radius: (size / 2.0) as u16,
+ border_radius: size / 2.0,
border_width: style.border_width,
border_color: style.border_color,
};
@@ -58,8 +58,8 @@ where
height: bounds.height - dot_size,
},
background: Background::Color(style.dot_color),
- border_radius: (dot_size / 2.0) as u16,
- border_width: 0,
+ border_radius: dot_size / 2.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
};
diff --git a/graphics/src/widget/rule.rs b/graphics/src/widget/rule.rs
index a7a5d0e7..835ebed8 100644
--- a/graphics/src/widget/rule.rs
+++ b/graphics/src/widget/rule.rs
@@ -43,7 +43,7 @@ where
},
background: Background::Color(style.color),
border_radius: style.radius,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
}
} else {
@@ -63,7 +63,7 @@ where
},
background: Background::Color(style.color),
border_radius: style.radius,
- border_width: 0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
}
};
diff --git a/graphics/src/widget/scrollable.rs b/graphics/src/widget/scrollable.rs
index fed79c18..57065ba2 100644
--- a/graphics/src/widget/scrollable.rs
+++ b/graphics/src/widget/scrollable.rs
@@ -103,7 +103,7 @@ where
};
let is_scrollbar_visible =
- style.background.is_some() || style.border_width > 0;
+ style.background.is_some() || style.border_width > 0.0;
let scroller = if is_mouse_over
|| state.is_scroller_grabbed()
diff --git a/graphics/src/widget/slider.rs b/graphics/src/widget/slider.rs
index 99f0a098..051e18b8 100644
--- a/graphics/src/widget/slider.rs
+++ b/graphics/src/widget/slider.rs
@@ -57,8 +57,8 @@ where
height: 2.0,
},
background: Background::Color(style.rail_colors.0),
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Primitive::Quad {
@@ -69,8 +69,8 @@ where
height: 2.0,
},
background: Background::Color(style.rail_colors.1),
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
);
@@ -82,7 +82,7 @@ where
.shape
{
HandleShape::Circle { radius } => {
- (f32::from(radius * 2), f32::from(radius * 2), radius)
+ (radius * 2.0, radius * 2.0, radius)
}
HandleShape::Rectangle {
width,
diff --git a/graphics/src/widget/text_input.rs b/graphics/src/widget/text_input.rs
index 575d67f5..55eb34e4 100644
--- a/graphics/src/widget/text_input.rs
+++ b/graphics/src/widget/text_input.rs
@@ -149,8 +149,8 @@ where
background: Background::Color(
style_sheet.value_color(),
),
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
offset,
@@ -193,8 +193,8 @@ where
background: Background::Color(
style_sheet.selection_color(),
),
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
if end == right {
diff --git a/style/src/button.rs b/style/src/button.rs
index 1e3844f9..43d27216 100644
--- a/style/src/button.rs
+++ b/style/src/button.rs
@@ -6,8 +6,8 @@ use iced_core::{Background, Color, Vector};
pub struct Style {
pub shadow_offset: Vector,
pub background: Option<Background>,
- pub border_radius: u16,
- pub border_width: u16,
+ pub border_radius: f32,
+ pub border_width: f32,
pub border_color: Color,
pub text_color: Color,
}
@@ -17,8 +17,8 @@ impl std::default::Default for Style {
Self {
shadow_offset: Vector::default(),
background: None,
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
text_color: Color::BLACK,
}
@@ -72,8 +72,8 @@ impl StyleSheet for Default {
Style {
shadow_offset: Vector::new(0.0, 0.0),
background: Some(Background::Color([0.87, 0.87, 0.87].into())),
- border_radius: 2,
- border_width: 1,
+ border_radius: 2.0,
+ border_width: 1.0,
border_color: [0.7, 0.7, 0.7].into(),
text_color: Color::BLACK,
}
diff --git a/style/src/checkbox.rs b/style/src/checkbox.rs
index 3c645f15..1c5f2460 100644
--- a/style/src/checkbox.rs
+++ b/style/src/checkbox.rs
@@ -6,8 +6,8 @@ use iced_core::{Background, Color};
pub struct Style {
pub background: Background,
pub checkmark_color: Color,
- pub border_radius: u16,
- pub border_width: u16,
+ pub border_radius: f32,
+ pub border_width: f32,
pub border_color: Color,
}
@@ -25,8 +25,8 @@ impl StyleSheet for Default {
Style {
background: Background::Color(Color::from_rgb(0.95, 0.95, 0.95)),
checkmark_color: Color::from_rgb(0.3, 0.3, 0.3),
- border_radius: 5,
- border_width: 1,
+ border_radius: 5.0,
+ border_width: 1.0,
border_color: Color::from_rgb(0.6, 0.6, 0.6),
}
}
diff --git a/style/src/container.rs b/style/src/container.rs
index d2247342..1ce6a7ca 100644
--- a/style/src/container.rs
+++ b/style/src/container.rs
@@ -6,8 +6,8 @@ use iced_core::{Background, Color};
pub struct Style {
pub text_color: Option<Color>,
pub background: Option<Background>,
- pub border_radius: u16,
- pub border_width: u16,
+ pub border_radius: f32,
+ pub border_width: f32,
pub border_color: Color,
}
@@ -16,8 +16,8 @@ impl std::default::Default for Style {
Self {
text_color: None,
background: None,
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
}
}
@@ -36,8 +36,8 @@ impl StyleSheet for Default {
Style {
text_color: None,
background: None,
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
}
}
diff --git a/style/src/menu.rs b/style/src/menu.rs
index e8321dc7..90985b8f 100644
--- a/style/src/menu.rs
+++ b/style/src/menu.rs
@@ -5,7 +5,7 @@ use iced_core::{Background, Color};
pub struct Style {
pub text_color: Color,
pub background: Background,
- pub border_width: u16,
+ pub border_width: f32,
pub border_color: Color,
pub selected_text_color: Color,
pub selected_background: Background,
@@ -16,7 +16,7 @@ impl std::default::Default for Style {
Self {
text_color: Color::BLACK,
background: Background::Color([0.87, 0.87, 0.87].into()),
- border_width: 1,
+ border_width: 1.0,
border_color: [0.7, 0.7, 0.7].into(),
selected_text_color: Color::WHITE,
selected_background: Background::Color([0.4, 0.4, 1.0].into()),
diff --git a/style/src/pick_list.rs b/style/src/pick_list.rs
index fbd431c0..a757ba98 100644
--- a/style/src/pick_list.rs
+++ b/style/src/pick_list.rs
@@ -6,8 +6,8 @@ use iced_core::{Background, Color};
pub struct Style {
pub text_color: Color,
pub background: Background,
- pub border_radius: u16,
- pub border_width: u16,
+ pub border_radius: f32,
+ pub border_width: f32,
pub border_color: Color,
pub icon_size: f32,
}
@@ -17,8 +17,8 @@ impl std::default::Default for Style {
Self {
text_color: Color::BLACK,
background: Background::Color([0.87, 0.87, 0.87].into()),
- border_radius: 0,
- border_width: 1,
+ border_radius: 0.0,
+ border_width: 1.0,
border_color: [0.7, 0.7, 0.7].into(),
icon_size: 0.7,
}
diff --git a/style/src/progress_bar.rs b/style/src/progress_bar.rs
index 73503fa8..36be63f9 100644
--- a/style/src/progress_bar.rs
+++ b/style/src/progress_bar.rs
@@ -6,7 +6,7 @@ use iced_core::{Background, Color};
pub struct Style {
pub background: Background,
pub bar: Background,
- pub border_radius: u16,
+ pub border_radius: f32,
}
/// A set of rules that dictate the style of a progress bar.
@@ -21,7 +21,7 @@ impl StyleSheet for Default {
Style {
background: Background::Color(Color::from_rgb(0.6, 0.6, 0.6)),
bar: Background::Color(Color::from_rgb(0.3, 0.9, 0.3)),
- border_radius: 5,
+ border_radius: 5.0,
}
}
}
diff --git a/style/src/radio.rs b/style/src/radio.rs
index 1f0689b9..83310e05 100644
--- a/style/src/radio.rs
+++ b/style/src/radio.rs
@@ -6,7 +6,7 @@ use iced_core::{Background, Color};
pub struct Style {
pub background: Background,
pub dot_color: Color,
- pub border_width: u16,
+ pub border_width: f32,
pub border_color: Color,
}
@@ -24,7 +24,7 @@ impl StyleSheet for Default {
Style {
background: Background::Color(Color::from_rgb(0.95, 0.95, 0.95)),
dot_color: Color::from_rgb(0.3, 0.3, 0.3),
- border_width: 1,
+ border_width: 1.0,
border_color: Color::from_rgb(0.6, 0.6, 0.6),
}
}
diff --git a/style/src/rule.rs b/style/src/rule.rs
index 6ba54e33..c809ae2f 100644
--- a/style/src/rule.rs
+++ b/style/src/rule.rs
@@ -74,7 +74,7 @@ pub struct Style {
/// The width (thickness) of the rule line.
pub width: u16,
/// The radius of the line corners.
- pub radius: u16,
+ pub radius: f32,
/// The [`FillMode`] of the rule.
///
/// [`FillMode`]: enum.FillMode.html
@@ -94,7 +94,7 @@ impl StyleSheet for Default {
Style {
color: [0.6, 0.6, 0.6, 0.51].into(),
width: 1,
- radius: 0,
+ radius: 0.0,
fill_mode: FillMode::Percent(90.0),
}
}
diff --git a/style/src/scrollable.rs b/style/src/scrollable.rs
index 690c14a2..65da9803 100644
--- a/style/src/scrollable.rs
+++ b/style/src/scrollable.rs
@@ -5,8 +5,8 @@ use iced_core::{Background, Color};
#[derive(Debug, Clone, Copy)]
pub struct Scrollbar {
pub background: Option<Background>,
- pub border_radius: u16,
- pub border_width: u16,
+ pub border_radius: f32,
+ pub border_width: f32,
pub border_color: Color,
pub scroller: Scroller,
}
@@ -15,8 +15,8 @@ pub struct Scrollbar {
#[derive(Debug, Clone, Copy)]
pub struct Scroller {
pub color: Color,
- pub border_radius: u16,
- pub border_width: u16,
+ pub border_radius: f32,
+ pub border_width: f32,
pub border_color: Color,
}
@@ -40,13 +40,13 @@ impl StyleSheet for Default {
fn active(&self) -> Scrollbar {
Scrollbar {
background: None,
- border_radius: 5,
- border_width: 0,
+ border_radius: 5.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
scroller: Scroller {
color: [0.0, 0.0, 0.0, 0.7].into(),
- border_radius: 5,
- border_width: 0,
+ border_radius: 5.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
},
}
diff --git a/style/src/slider.rs b/style/src/slider.rs
index 776e180c..9148fcbe 100644
--- a/style/src/slider.rs
+++ b/style/src/slider.rs
@@ -13,15 +13,15 @@ pub struct Style {
pub struct Handle {
pub shape: HandleShape,
pub color: Color,
- pub border_width: u16,
+ pub border_width: f32,
pub border_color: Color,
}
/// The shape of the handle of a slider.
#[derive(Debug, Clone, Copy)]
pub enum HandleShape {
- Circle { radius: u16 },
- Rectangle { width: u16, border_radius: u16 },
+ Circle { radius: f32 },
+ Rectangle { width: u16, border_radius: f32 },
}
/// A set of rules that dictate the style of a slider.
@@ -45,11 +45,11 @@ impl StyleSheet for Default {
handle: Handle {
shape: HandleShape::Rectangle {
width: 8,
- border_radius: 4,
+ border_radius: 4.0,
},
color: Color::from_rgb(0.95, 0.95, 0.95),
border_color: Color::from_rgb(0.6, 0.6, 0.6),
- border_width: 1,
+ border_width: 1.0,
},
}
}
diff --git a/style/src/text_input.rs b/style/src/text_input.rs
index 1cb72364..19acea65 100644
--- a/style/src/text_input.rs
+++ b/style/src/text_input.rs
@@ -5,8 +5,8 @@ use iced_core::{Background, Color};
#[derive(Debug, Clone, Copy)]
pub struct Style {
pub background: Background,
- pub border_radius: u16,
- pub border_width: u16,
+ pub border_radius: f32,
+ pub border_width: f32,
pub border_color: Color,
}
@@ -14,8 +14,8 @@ impl std::default::Default for Style {
fn default() -> Self {
Self {
background: Background::Color(Color::WHITE),
- border_radius: 0,
- border_width: 0,
+ border_radius: 0.0,
+ border_width: 0.0,
border_color: Color::TRANSPARENT,
}
}
@@ -47,8 +47,8 @@ impl StyleSheet for Default {
fn active(&self) -> Style {
Style {
background: Background::Color(Color::WHITE),
- border_radius: 5,
- border_width: 1,
+ border_radius: 5.0,
+ border_width: 1.0,
border_color: Color::from_rgb(0.7, 0.7, 0.7),
}
}