summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorIgnas S <anon>2019-08-11 12:53:02 +0300
committerAndreas Kling <awesomekling@gmail.com>2019-08-11 12:00:10 +0200
commitfeabe6ed31489fadb74cabd61e20d644e3a51089 (patch)
treec58304267baabc9cda7053cb6673cc7bea435523 /Libraries
parentb07a31573664ed574c0c8e807b197b8c2dd14ba2 (diff)
downloadserenity-feabe6ed31489fadb74cabd61e20d644e3a51089.zip
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.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/GScrollBar.cpp4
-rw-r--r--Libraries/LibGUI/GScrollBar.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GScrollBar.cpp b/Libraries/LibGUI/GScrollBar.cpp
index 473eef11b1..32b31f8985 100644
--- a/Libraries/LibGUI/GScrollBar.cpp
+++ b/Libraries/LibGUI/GScrollBar.cpp
@@ -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)
diff --git a/Libraries/LibGUI/GScrollBar.h b/Libraries/LibGUI/GScrollBar.h
index 2197e51bd2..289d0c283d 100644
--- a/Libraries/LibGUI/GScrollBar.h
+++ b/Libraries/LibGUI/GScrollBar.h
@@ -70,6 +70,7 @@ private:
Orientation m_orientation { Orientation::Vertical };
Component m_hovered_component { Component::Invalid };
+ bool m_scrubber_in_use { false };
enum class AutomaticScrollingDirection {
None = 0,