1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 19:15:07 +00:00

GScrollBar: highlight the scrubber while it's in use.

Originally, it would stop being highlighted if the mouse was moved away from
it, even while in use. Now it will stay highlighted for the duration of
usage.
This commit is contained in:
Ignas S 2019-08-11 12:53:02 +03:00 committed by Andreas Kling
parent b07a315736
commit feabe6ed31
2 changed files with 4 additions and 1 deletions

View file

@ -208,7 +208,7 @@ void GScrollBar::paint_event(GPaintEvent& event)
}
if (has_scrubber())
StylePainter::paint_button(painter, scrubber_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::Scrubber);
StylePainter::paint_button(painter, scrubber_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::Scrubber || m_scrubber_in_use);
}
void GScrollBar::on_automatic_scrolling_timer_fired()
@ -238,6 +238,7 @@ void GScrollBar::mousedown_event(GMouseEvent& event)
return;
}
if (has_scrubber() && scrubber_rect().contains(event.position())) {
m_scrubber_in_use = true;
m_scrubbing = true;
m_scrub_start_value = value();
m_scrub_origin = event.position();
@ -270,6 +271,7 @@ void GScrollBar::mouseup_event(GMouseEvent& event)
{
if (event.button() != GMouseButton::Left)
return;
m_scrubber_in_use = false;
m_automatic_scrolling_direction = AutomaticScrollingDirection::None;
set_automatic_scrolling_active(false);
if (!m_scrubbing)