Always show scroller if scrollbar is visible
This commit is contained in:
parent
ed30b487d6
commit
3d26eb79c2
@ -66,7 +66,6 @@ impl scrollable::Renderer for Renderer {
|
|||||||
|
|
||||||
(
|
(
|
||||||
if let Some(scrollbar) = scrollbar {
|
if let Some(scrollbar) = scrollbar {
|
||||||
if is_mouse_over || state.is_scroller_grabbed() {
|
|
||||||
let style = if state.is_scroller_grabbed() {
|
let style = if state.is_scroller_grabbed() {
|
||||||
style_sheet.dragging()
|
style_sheet.dragging()
|
||||||
} else if is_mouse_over_scrollbar {
|
} else if is_mouse_over_scrollbar {
|
||||||
@ -75,42 +74,46 @@ impl scrollable::Renderer for Renderer {
|
|||||||
style_sheet.active()
|
style_sheet.active()
|
||||||
};
|
};
|
||||||
|
|
||||||
let scroller = Primitive::Quad {
|
let is_scrollbar_visible =
|
||||||
|
style.background.is_some() || style.border_width > 0;
|
||||||
|
|
||||||
|
let scroller = if is_mouse_over
|
||||||
|
|| state.is_scroller_grabbed()
|
||||||
|
|| is_scrollbar_visible
|
||||||
|
{
|
||||||
|
Primitive::Quad {
|
||||||
bounds: scrollbar.scroller.bounds,
|
bounds: scrollbar.scroller.bounds,
|
||||||
background: Background::Color(style.scroller.color),
|
background: Background::Color(style.scroller.color),
|
||||||
border_radius: style.scroller.border_radius,
|
border_radius: style.scroller.border_radius,
|
||||||
border_width: style.scroller.border_width,
|
border_width: style.scroller.border_width,
|
||||||
border_color: style.scroller.border_color,
|
border_color: style.scroller.border_color,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Primitive::None
|
||||||
};
|
};
|
||||||
|
|
||||||
if style.background.is_some() || style.border_width > 0 {
|
let scrollbar = if is_scrollbar_visible {
|
||||||
let scrollbar = Primitive::Quad {
|
Primitive::Quad {
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
x: scrollbar.bounds.x
|
x: scrollbar.bounds.x + f32::from(SCROLLBAR_MARGIN),
|
||||||
+ f32::from(SCROLLBAR_MARGIN),
|
|
||||||
width: scrollbar.bounds.width
|
width: scrollbar.bounds.width
|
||||||
- f32::from(2 * SCROLLBAR_MARGIN),
|
- f32::from(2 * SCROLLBAR_MARGIN),
|
||||||
..scrollbar.bounds
|
..scrollbar.bounds
|
||||||
},
|
},
|
||||||
background: style.background.unwrap_or(
|
background: style
|
||||||
Background::Color(Color::TRANSPARENT),
|
.background
|
||||||
),
|
.unwrap_or(Background::Color(Color::TRANSPARENT)),
|
||||||
border_radius: style.border_radius,
|
border_radius: style.border_radius,
|
||||||
border_width: style.border_width,
|
border_width: style.border_width,
|
||||||
border_color: style.border_color,
|
border_color: style.border_color,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Primitive::None
|
||||||
};
|
};
|
||||||
|
|
||||||
Primitive::Group {
|
Primitive::Group {
|
||||||
primitives: vec![clip, scrollbar, scroller],
|
primitives: vec![clip, scrollbar, scroller],
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Primitive::Group {
|
|
||||||
primitives: vec![clip, scroller],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
clip
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
clip
|
clip
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user