Set Scroll active to true when dragging scrollbars
@@ -313,7 +313,18 @@ impl<T: Data, W: Widget<T>> Widget<T> for Scroll<T, W> {
}
ctx.request_paint();
}
- Event::MouseUp(_) => self.scroll_bars.held = BarHeldState::None,
+ Event::MouseUp(event) => {
+ self.scroll_bars.held = BarHeldState::None;
+ ctx.set_active(false);
+
+ let offset_pos = event.pos + self.scroll_offset;
+ if !self.point_hits_vertical_bar(viewport, offset_pos, &env)
+ && !self.point_hits_horizontal_bar(viewport, offset_pos, &env)
+ {
+ self.scroll_bars.hovered = BarHoveredState::None;
+ self.reset_scrollbar_fade(ctx, &env);
+ }
+ }
_ => (), // other events are a noop
}
} else if scroll_bar_is_hovered {
@@ -335,10 +346,12 @@ impl<T: Data, W: Widget<T>> Widget<T> for Scroll<T, W> {
let pos = event.pos + self.scroll_offset;
if self.point_hits_vertical_bar(viewport, pos, &env) {
+ ctx.set_active(true);
self.scroll_bars.held = BarHeldState::Vertical(
pos.y - self.calc_vertical_bar_bounds(viewport, &env).y0,
);
} else if self.point_hits_horizontal_bar(viewport, pos, &env) {
+ ctx.set_active(true);
self.scroll_bars.held = BarHeldState::Horizontal(
pos.x - self.calc_horizontal_bar_bounds(viewport, &env).x0,
);
