Fix handle position of sliders
This commit is contained in:
parent
52c84c4975
commit
2be79d7b6b
2 changed files with 8 additions and 8 deletions
|
|
@ -391,7 +391,7 @@ pub fn draw<T, R>(
|
||||||
let offset = if range_start >= range_end {
|
let offset = if range_start >= range_end {
|
||||||
0.0
|
0.0
|
||||||
} else {
|
} else {
|
||||||
(bounds.width - handle_width) * (value - range_start)
|
(bounds.width - handle_width / 2.0) * (value - range_start)
|
||||||
/ (range_end - range_start)
|
/ (range_end - range_start)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -402,7 +402,7 @@ pub fn draw<T, R>(
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: bounds.x,
|
x: bounds.x,
|
||||||
y: rail_y - style.rail.width / 2.0,
|
y: rail_y - style.rail.width / 2.0,
|
||||||
width: offset,
|
width: offset + handle_width / 2.0,
|
||||||
height: style.rail.width,
|
height: style.rail.width,
|
||||||
},
|
},
|
||||||
border_radius: Default::default(),
|
border_radius: Default::default(),
|
||||||
|
|
@ -415,7 +415,7 @@ pub fn draw<T, R>(
|
||||||
renderer.fill_quad(
|
renderer.fill_quad(
|
||||||
renderer::Quad {
|
renderer::Quad {
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: bounds.x + offset,
|
x: bounds.x + offset + handle_width / 2.0,
|
||||||
y: rail_y - style.rail.width / 2.0,
|
y: rail_y - style.rail.width / 2.0,
|
||||||
width: bounds.width - offset,
|
width: bounds.width - offset,
|
||||||
height: style.rail.width,
|
height: style.rail.width,
|
||||||
|
|
@ -430,7 +430,7 @@ pub fn draw<T, R>(
|
||||||
renderer.fill_quad(
|
renderer.fill_quad(
|
||||||
renderer::Quad {
|
renderer::Quad {
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: bounds.x + offset.round(),
|
x: bounds.x + offset,
|
||||||
y: rail_y - handle_height / 2.0,
|
y: rail_y - handle_height / 2.0,
|
||||||
width: handle_width,
|
width: handle_width,
|
||||||
height: handle_height,
|
height: handle_height,
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,7 @@ pub fn draw<T, R>(
|
||||||
let offset = if range_start >= range_end {
|
let offset = if range_start >= range_end {
|
||||||
0.0
|
0.0
|
||||||
} else {
|
} else {
|
||||||
(bounds.height - handle_width) * (value - range_end)
|
(bounds.height - handle_width / 2.0) * (value - range_end)
|
||||||
/ (range_start - range_end)
|
/ (range_start - range_end)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -396,7 +396,7 @@ pub fn draw<T, R>(
|
||||||
x: rail_x - style.rail.width / 2.0,
|
x: rail_x - style.rail.width / 2.0,
|
||||||
y: bounds.y,
|
y: bounds.y,
|
||||||
width: style.rail.width,
|
width: style.rail.width,
|
||||||
height: offset,
|
height: offset + handle_width / 2.0,
|
||||||
},
|
},
|
||||||
border_radius: Default::default(),
|
border_radius: Default::default(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
|
|
@ -409,7 +409,7 @@ pub fn draw<T, R>(
|
||||||
renderer::Quad {
|
renderer::Quad {
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: rail_x - style.rail.width / 2.0,
|
x: rail_x - style.rail.width / 2.0,
|
||||||
y: bounds.y + offset,
|
y: bounds.y + offset + handle_width / 2.0,
|
||||||
width: style.rail.width,
|
width: style.rail.width,
|
||||||
height: bounds.height - offset,
|
height: bounds.height - offset,
|
||||||
},
|
},
|
||||||
|
|
@ -424,7 +424,7 @@ pub fn draw<T, R>(
|
||||||
renderer::Quad {
|
renderer::Quad {
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: rail_x - handle_height / 2.0,
|
x: rail_x - handle_height / 2.0,
|
||||||
y: bounds.y + offset.round(),
|
y: bounds.y + offset,
|
||||||
width: handle_height,
|
width: handle_height,
|
||||||
height: handle_width,
|
height: handle_width,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue