ソースを参照

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.
Nico Weber 5 年 前
コミット
c34956839e
1 ファイル変更5 行追加8 行削除
  1. 5 8
      Libraries/LibGUI/ScrollBar.cpp

+ 5 - 8
Libraries/LibGUI/ScrollBar.cpp

@@ -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)