Fix slider's handle position calculation
This commit is contained in:
parent
13a2997deb
commit
c0e10f2e9d
1 changed files with 4 additions and 4 deletions
|
|
@ -258,7 +258,7 @@ pub fn draw<T>(
|
||||||
renderer::Quad {
|
renderer::Quad {
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: bounds.x,
|
x: bounds.x,
|
||||||
y: rail_y,
|
y: rail_y - 1.0,
|
||||||
width: bounds.width,
|
width: bounds.width,
|
||||||
height: 2.0,
|
height: 2.0,
|
||||||
},
|
},
|
||||||
|
|
@ -273,7 +273,7 @@ pub fn draw<T>(
|
||||||
renderer::Quad {
|
renderer::Quad {
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: bounds.x,
|
x: bounds.x,
|
||||||
y: rail_y + 2.0,
|
y: rail_y + 1.0,
|
||||||
width: bounds.width,
|
width: bounds.width,
|
||||||
height: 2.0,
|
height: 2.0,
|
||||||
},
|
},
|
||||||
|
|
@ -305,8 +305,8 @@ pub fn draw<T>(
|
||||||
let handle_offset = if range_start >= range_end {
|
let handle_offset = if range_start >= range_end {
|
||||||
0.0
|
0.0
|
||||||
} else {
|
} else {
|
||||||
(bounds.width - handle_width) * (value - range_start)
|
bounds.width * (value - range_start) / (range_end - range_start)
|
||||||
/ (range_end - range_start)
|
- handle_width / 2.0
|
||||||
};
|
};
|
||||||
|
|
||||||
renderer.fill_quad(
|
renderer.fill_quad(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue