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

Unified Diff: ui/views/controls/slider.cc

Issue 2335513002: Adding ripple effect for clicks on MD slider (Closed)
Patch Set: adding animation Created 4 years, 3 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
« ui/views/controls/slider.h ('K') | « ui/views/controls/slider.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/slider.cc
diff --git a/ui/views/controls/slider.cc b/ui/views/controls/slider.cc
index dd1148ff1a59123e6f2c960404aee5ffe732267c..d390792c52db17ec139b19d053af5d20049e8fea 100644
--- a/ui/views/controls/slider.cc
+++ b/ui/views/controls/slider.cc
@@ -179,6 +179,7 @@ float Slider::GetAnimatingValue() const{
bool Slider::OnMousePressed(const ui::MouseEvent& event) {
if (!event.IsOnlyLeftMouseButton())
return false;
+ SetFocus(true);
bruthig 2016/09/21 00:27:46 Instead of calling SetFocus() from OnMousePressed(
yiyix 2016/09/21 15:20:52 good call!!
OnSliderDragStarted();
PrepareForMove(event.location().x());
MoveButtonTo(event.location());
@@ -191,6 +192,7 @@ bool Slider::OnMouseDragged(const ui::MouseEvent& event) {
}
void Slider::OnMouseReleased(const ui::MouseEvent& event) {
+ SetFocus(false);
OnSliderDragEnded();
}
@@ -208,11 +210,13 @@ bool Slider::OnKeyPressed(const ui::KeyEvent& event) {
void Slider::OnFocus() {
View::OnFocus();
+ SetFocus(true);
SchedulePaint();
}
void Slider::OnBlur() {
View::OnBlur();
+ SetFocus(false);
SchedulePaint();
}
@@ -226,10 +230,12 @@ void Slider::OnGestureEvent(ui::GestureEvent* event) {
// Intentional fall through to next case.
case ui::ET_GESTURE_SCROLL_BEGIN:
case ui::ET_GESTURE_SCROLL_UPDATE:
+ SetFocus(true);
MoveButtonTo(event->location());
event->SetHandled();
break;
case ui::ET_GESTURE_END:
+ SetFocus(false);
MoveButtonTo(event->location());
event->SetHandled();
if (event->details().touch_points() <= 1)
« ui/views/controls/slider.h ('K') | « ui/views/controls/slider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698