Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1098)

Unified Diff: ui/views/controls/scrollbar/overlay_scroll_bar.cc

Issue 16909002: Fix overlay scrollbar's response to gesture events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix normal state Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/scrollbar/overlay_scroll_bar.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scrollbar/overlay_scroll_bar.cc
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.cc b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
index c7e254a6a026ef8a00f9a3b45c988e7e857faa65..b9f52ef9cd50980d72200be6fad047331c3f8113 100644
--- a/ui/views/controls/scrollbar/overlay_scroll_bar.cc
+++ b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
@@ -62,10 +62,15 @@ gfx::Size OverlayScrollBarThumb::GetPreferredSize() {
void OverlayScrollBarThumb::OnPaint(gfx::Canvas* canvas) {
gfx::Rect local_bounds(GetLocalBounds());
SkPaint paint;
- int alpha = (GetState() == CustomButton::STATE_HOVERED ||
- GetState() == CustomButton::STATE_PRESSED) ?
- kThumbHoverAlpha : kThumbDefaultAlpha;
- alpha *= animation_opacity_;
+ int alpha = kThumbDefaultAlpha * animation_opacity_;
+ if (GetState() == CustomButton::STATE_HOVERED) {
+ alpha = kThumbHoverAlpha * animation_opacity_;
+ } else if(GetState() == CustomButton::STATE_PRESSED) {
+ // If we are in pressed state, no need to worry about animation,
+ // just display the deeper color.
+ alpha = kThumbHoverAlpha;
+ }
+
paint.setStyle(SkPaint::kFill_Style);
paint.setColor(SkColorSetARGB(alpha, 0, 0, 0));
canvas->DrawRoundRect(local_bounds, kThumbCornerRadius, paint);
@@ -119,6 +124,14 @@ void OverlayScrollBar::OnMouseExitedScrollView(const ui::MouseEvent& event) {
animation_.Hide();
}
+void OverlayScrollBar::OnGestureEvent(ui::GestureEvent* event) {
+ if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN)
+ animation_.Show();
+ else if (event->type() == ui::ET_GESTURE_SCROLL_END)
+ animation_.Hide();
Jun Mukai 2013/06/13 19:11:23 The scrollbar doesn't hide when I fling the scroll
Jun Mukai 2013/06/21 21:12:43 How did you address the issue I commented? As far
+ BaseScrollBar::OnGestureEvent(event);
+}
+
gfx::Size OverlayScrollBar::GetPreferredSize() {
return gfx::Size();
}
« no previous file with comments | « ui/views/controls/scrollbar/overlay_scroll_bar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698