mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
LibGUI: Make ScrollBar shift-click use same code path as scrubber click
It's slightly less code, and m_scrubber_in_use is now set correctly when shift-clicking, keeping the mouse button down, and then dragging the throbber. The shift-click brings the scrubber under the cursor, and then the scrubber_rect().contains() condition is true and both scrubber drags and shift-click-drags are handled the same naturally.
This commit is contained in:
parent
88a2c245e5
commit
c34956839e
1 changed files with 5 additions and 8 deletions
|
@ -290,6 +290,9 @@ void ScrollBar::mousedown_event(MouseEvent& event)
|
|||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.shift())
|
||||
scroll_to_position(event.position());
|
||||
if (scrubber_rect().contains(event.position())) {
|
||||
m_scrubber_in_use = true;
|
||||
m_scrubbing = true;
|
||||
|
@ -298,16 +301,10 @@ void ScrollBar::mousedown_event(MouseEvent& event)
|
|||
update();
|
||||
return;
|
||||
}
|
||||
ASSERT(!event.shift());
|
||||
|
||||
// FIXME: If scrolling by page, scroll every second or so while mouse is down.
|
||||
if (event.shift())
|
||||
scroll_to_position(event.position());
|
||||
else
|
||||
scroll_by_page(event.position());
|
||||
|
||||
m_scrubbing = true;
|
||||
m_scrub_start_value = value();
|
||||
m_scrub_origin = event.position();
|
||||
scroll_by_page(event.position());
|
||||
}
|
||||
|
||||
void ScrollBar::mouseup_event(MouseEvent& event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue