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

Side by Side Diff: athena/home/home_card_gesture_manager.cc

Issue 478293004: Refactor the home card structure and introduce animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « athena/home/athena_start_page_view.cc ('k') | athena/home/home_card_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/home/home_card_gesture_manager.h" 5 #include "athena/home/home_card_gesture_manager.h"
6 6
7 #include "athena/home/home_card_constants.h" 7 #include "athena/home/home_card_constants.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 9
10 namespace athena { 10 namespace athena {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 float bigger_height = kHomeCardHeight; 92 float bigger_height = kHomeCardHeight;
93 if (last_estimated_height_ > kHomeCardHeight) { 93 if (last_estimated_height_ > kHomeCardHeight) {
94 state = HomeCard::VISIBLE_CENTERED; 94 state = HomeCard::VISIBLE_CENTERED;
95 smaller_height = kHomeCardHeight; 95 smaller_height = kHomeCardHeight;
96 bigger_height = screen_bounds_.height(); 96 bigger_height = screen_bounds_.height();
97 } 97 }
98 98
99 // The finger is between two states. 99 // The finger is between two states.
100 float progress = (last_estimated_height_ - smaller_height) / 100 float progress = (last_estimated_height_ - smaller_height) /
101 (bigger_height - smaller_height); 101 (bigger_height - smaller_height);
102 progress = std::min(1.0f, std::max(0.0f, progress));
102 103
103 if (last_state_ == state) { 104 if (last_state_ == state) {
104 if (event.details().scroll_y() > 0) { 105 if (event.details().scroll_y() > 0) {
105 state = static_cast<HomeCard::State>(state + 1); 106 state = static_cast<HomeCard::State>(state + 1);
106 progress = 1.0f - progress; 107 progress = 1.0f - progress;
107 } else { 108 } else {
108 last_state_ = static_cast<HomeCard::State>(last_state_ + 1); 109 last_state_ = static_cast<HomeCard::State>(last_state_ + 1);
109 } 110 }
110 } 111 }
111 delegate_->OnGestureProgressed(last_state_, state, progress); 112 delegate_->OnGestureProgressed(last_state_, state, progress);
112 last_state_ = state; 113 last_state_ = state;
113 } 114 }
114 115
115 } // namespace athena 116 } // namespace athena
OLDNEW
« no previous file with comments | « athena/home/athena_start_page_view.cc ('k') | athena/home/home_card_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698