Skip to content

Commit

Permalink
fix: slider rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Oct 22, 2024
1 parent 57598f2 commit cc87249
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions widget/src/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,20 +511,16 @@ where
let radius = (radius)
.max(2.0 * border_width)
.min(bounds.height / 2.0)
.min(bounds.width / 2.0);
.min(bounds.width / 2.0 + 2.0 * border_width);
(radius * 2.0, radius * 2.0, Radius::from(radius))
}
HandleShape::Rectangle {
height,
width,
border_radius,
} => {
let width = (f32::from(width))
.max(2.0 * border_width)
.min(bounds.width);
let height = (f32::from(height))
.max(2.0 * border_width)
.min(bounds.height);
let width = (f32::from(width)).max(2.0 * border_width);
let height = (f32::from(height)).max(2.0 * border_width);
let mut border_radius: [f32; 4] = border_radius.into();
for r in &mut border_radius {
*r = (*r)
Expand Down Expand Up @@ -611,23 +607,9 @@ where
renderer.fill_quad(
renderer::Quad {
bounds: Rectangle {
x: bounds.x,
y: rail_y - style.rail.width / 2.0,
width: offset + handle_width / 2.0,
height: style.rail.width,
},
border: style.rail.border,
..renderer::Quad::default()
},
style.rail.backgrounds.0,
);

renderer.fill_quad(
renderer::Quad {
bounds: Rectangle {
x: bounds.x,
x: bounds.x + offset + handle_width / 2.0,
y: rail_y - style.rail.width / 2.0,
width: offset + handle_width / 2.0,
width: bounds.width - offset - handle_width / 2.0,
height: style.rail.width,
},
border: style.rail.border,
Expand Down

0 comments on commit cc87249

Please sign in to comment.