Skip to content

Commit feabe6e

Browse files
Ignas Sawesomekling
authored andcommitted
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.
1 parent b07a315 commit feabe6e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Libraries/LibGUI/GScrollBar.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void GScrollBar::paint_event(GPaintEvent& event)
208208
}
209209

210210
if (has_scrubber())
211-
StylePainter::paint_button(painter, scrubber_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::Scrubber);
211+
StylePainter::paint_button(painter, scrubber_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::Scrubber || m_scrubber_in_use);
212212
}
213213

214214
void GScrollBar::on_automatic_scrolling_timer_fired()
@@ -238,6 +238,7 @@ void GScrollBar::mousedown_event(GMouseEvent& event)
238238
return;
239239
}
240240
if (has_scrubber() && scrubber_rect().contains(event.position())) {
241+
m_scrubber_in_use = true;
241242
m_scrubbing = true;
242243
m_scrub_start_value = value();
243244
m_scrub_origin = event.position();
@@ -270,6 +271,7 @@ void GScrollBar::mouseup_event(GMouseEvent& event)
270271
{
271272
if (event.button() != GMouseButton::Left)
272273
return;
274+
m_scrubber_in_use = false;
273275
m_automatic_scrolling_direction = AutomaticScrollingDirection::None;
274276
set_automatic_scrolling_active(false);
275277
if (!m_scrubbing)

Libraries/LibGUI/GScrollBar.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class GScrollBar final : public GWidget {
7070

7171
Orientation m_orientation { Orientation::Vertical };
7272
Component m_hovered_component { Component::Invalid };
73+
bool m_scrubber_in_use { false };
7374

7475
enum class AutomaticScrollingDirection {
7576
None = 0,

0 commit comments

Comments
 (0)