diff --git a/Libraries/LibGUI/ScrollBar.cpp b/Libraries/LibGUI/ScrollBar.cpp index d33be96876..7f95b199eb 100644 --- a/Libraries/LibGUI/ScrollBar.cpp +++ b/Libraries/LibGUI/ScrollBar.cpp @@ -269,6 +269,10 @@ void ScrollBar::on_automatic_scrolling_timer_fired() set_value(value() + m_step); return; } + if (m_automatic_scrolling_kind == AutomaticScrollingKind::Gutter && component_at_position(m_last_mouse_position) == Component::Gutter) { + scroll_by_page(m_last_mouse_position); + return; + } } void ScrollBar::mousedown_event(MouseEvent& event) @@ -308,8 +312,8 @@ void ScrollBar::mousedown_event(MouseEvent& event) ASSERT(!event.shift()); ASSERT(clicked_component == Component::Gutter); - // FIXME: If scrolling by page, scroll every second or so while mouse is down. - scroll_by_page(event.position()); + set_automatic_scrolling_active(true, AutomaticScrollingKind::Gutter); + update(); } void ScrollBar::mouseup_event(MouseEvent& event) @@ -333,6 +337,10 @@ void ScrollBar::mousewheel_event(MouseEvent& event) void ScrollBar::set_automatic_scrolling_active(bool active, AutomaticScrollingKind kind) { m_automatic_scrolling_kind = kind; + if (m_automatic_scrolling_kind == AutomaticScrollingKind::Gutter) + m_automatic_scrolling_timer->set_interval(200); + else + m_automatic_scrolling_timer->set_interval(100); if (active) { on_automatic_scrolling_timer_fired(); diff --git a/Libraries/LibGUI/ScrollBar.h b/Libraries/LibGUI/ScrollBar.h index d885f494ae..cace204c0f 100644 --- a/Libraries/LibGUI/ScrollBar.h +++ b/Libraries/LibGUI/ScrollBar.h @@ -82,6 +82,7 @@ private: None = 0, DecrementButton, IncrementButton, + Gutter, }; int default_button_size() const { return 16; } @@ -103,7 +104,6 @@ private: void scroll_by_page(const Gfx::IntPoint&); Component component_at_position(const Gfx::IntPoint&); - void update_hovered_component(const Gfx::IntPoint&); int m_min { 0 }; int m_max { 0 };