Merge lp:~brandontschaefer/unity/lp.1163616-fix into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 3270
Proposed branch: lp:~brandontschaefer/unity/lp.1163616-fix
Merge into: lp:unity
Diff against target: 84 lines (+24/-7)
2 files modified
tests/test_overlay_scrollbar.cpp (+19/-0)
unity-shared/PlacesOverlayVScrollBar.cpp (+5/-7)
To merge this branch: bzr merge lp:~brandontschaefer/unity/lp.1163616-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andrea Azzarone (community) Approve
Review via email: mp+156721@code.launchpad.net

This proposal supersedes a proposal from 2013-01-16.

Commit message

Allows dragging of the normal scrollbar if the overlay scrollbars have reached the top/bottom.

Description of the change

Nick mentioned that it is very hard to use the scroll bar to drag all the way down. It is very noticeable in the previews for an application. I think it would be better if it would stop scrolling when the scroll bar it self hit the bottom/top not the overlay thumb.

Here is what it looks like in unity right now:
http://ubuntuone.com/1jc4PcPg8dsFH85r0AoO0U

As you can see, it is hard to scroll through the text, as the thumb it self is larger then the scrollbar, so you will have to scroll down, then move up and scroll down....slightly annoying.

**Note** John (Design) has approved of this change.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/test_overlay_scrollbar.cpp'
2--- tests/test_overlay_scrollbar.cpp 2013-01-17 16:11:14 +0000
3+++ tests/test_overlay_scrollbar.cpp 2013-04-02 23:43:24 +0000
4@@ -64,6 +64,7 @@
5 : PlacesOverlayVScrollBar(NUX_FILE_LINE_PARAM)
6 , scroll_tick_(1000 * 401)
7 , scroll_dy_(0)
8+ , thumbs_height_(overlay_window_->GetThumbGeometry().height)
9 , scroll_up_signal_(false)
10 , scroll_down_signal_(false)
11 {
12@@ -182,6 +183,11 @@
13 tick_source_.tick(scroll_tick_);
14 }
15
16+ void FakeDragDown()
17+ {
18+ OnMouseDrag(0, overlay_window_->GetThumbOffsetY() + 1, 0, 5, 0, 0);
19+ }
20+
21 nux::NuxTimerTickSource tick_source_;
22
23 using PlacesOverlayVScrollBar::connector_height_;
24@@ -189,6 +195,7 @@
25
26 int scroll_tick_;
27 int scroll_dy_;
28+ int thumbs_height_;
29 bool scroll_up_signal_;
30 bool scroll_down_signal_;
31 };
32@@ -419,5 +426,17 @@
33 EXPECT_EQ(connector_height, 0);
34 }
35
36+
37+TEST_F(TestOverlayVScrollBar, TestAllowDragIfOverlayIsAtMaximum)
38+{
39+ // Offset that sets the thumb at the bottom of the scrollbar
40+ int thumb_offset = scroll_view_->scroll_bar_->GetHeight() -
41+ scroll_view_->scroll_bar_->thumbs_height_;
42+
43+ scroll_view_->scroll_bar_->SetThumbOffset(thumb_offset);
44+ scroll_view_->scroll_bar_->FakeDragDown();
45+ EXPECT_TRUE(scroll_view_->scroll_bar_->scroll_down_signal_);
46+}
47+
48 }
49
50
51=== modified file 'unity-shared/PlacesOverlayVScrollBar.cpp'
52--- unity-shared/PlacesOverlayVScrollBar.cpp 2012-12-13 14:26:56 +0000
53+++ unity-shared/PlacesOverlayVScrollBar.cpp 2013-04-02 23:43:24 +0000
54@@ -85,7 +85,7 @@
55 if (!sensitive)
56 {
57 overlay_window_->ResetStates();
58- ResetConnector();
59+ ResetConnector();
60 }
61 }
62
63@@ -353,17 +353,15 @@
64 MouseDraggingOverlay(y, dy);
65 }
66
67-void PlacesOverlayVScrollBar::MouseDraggingOverlay(int y, int dys)
68+void PlacesOverlayVScrollBar::MouseDraggingOverlay(int y, int dy)
69 {
70- int const dy = y - overlay_window_->GetThumbOffsetY() - mouse_down_offset_;
71- int const at_min = overlay_window_->GetThumbOffsetY() <= 0;
72- int const at_max = overlay_window_->GetThumbOffsetY() + overlay_window_->GetThumbHeight() >= _track->GetBaseHeight();
73+ int const thumb_offset = overlay_window_->GetThumbOffsetY() + mouse_down_offset_;
74
75- if (dy < 0 && !at_min)
76+ if (dy < 0 && !AtMinimum() && y <= thumb_offset)
77 {
78 OnScrollUp.emit(stepY, abs(dy));
79 }
80- else if (dy > 0 && !at_max)
81+ else if (dy > 0 && !AtMaximum() && y >= thumb_offset)
82 {
83 OnScrollDown.emit(stepY, dy);
84 }