OLD | NEW |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 return HomeCard::VISIBLE_CENTERED; | 69 return HomeCard::VISIBLE_CENTERED; |
70 } | 70 } |
71 | 71 |
72 void HomeCardGestureManager::UpdateScrollState(const ui::GestureEvent& event) { | 72 void HomeCardGestureManager::UpdateScrollState(const ui::GestureEvent& event) { |
73 last_estimated_height_ = | 73 last_estimated_height_ = |
74 screen_bounds_.height() - event.root_location().y() + y_offset_; | 74 screen_bounds_.height() - event.root_location().y() + y_offset_; |
75 | 75 |
76 if (last_estimated_height_ <= kHomeCardMinimizedHeight) { | 76 if (last_estimated_height_ <= kHomeCardMinimizedHeight) { |
77 delegate_->OnGestureProgressed( | 77 delegate_->OnGestureProgressed( |
78 last_state_, HomeCard::VISIBLE_MINIMIZED, 1.0f); | 78 HomeCard::VISIBLE_BOTTOM, HomeCard::VISIBLE_MINIMIZED, 1.0f); |
79 last_state_ = HomeCard::VISIBLE_MINIMIZED; | 79 last_state_ = HomeCard::VISIBLE_MINIMIZED; |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 HomeCard::State state = HomeCard::VISIBLE_BOTTOM; | 83 HomeCard::State state = HomeCard::VISIBLE_BOTTOM; |
84 float smaller_height = kHomeCardMinimizedHeight; | 84 float smaller_height = kHomeCardMinimizedHeight; |
85 float bigger_height = kHomeCardHeight; | 85 float bigger_height = kHomeCardHeight; |
86 if (last_estimated_height_ > kHomeCardHeight) { | 86 if (last_estimated_height_ > kHomeCardHeight) { |
87 state = HomeCard::VISIBLE_CENTERED; | 87 state = HomeCard::VISIBLE_CENTERED; |
88 smaller_height = kHomeCardHeight; | 88 smaller_height = kHomeCardHeight; |
(...skipping 11 matching lines...) Expand all Loading... |
100 progress = 1.0f - progress; | 100 progress = 1.0f - progress; |
101 } else { | 101 } else { |
102 last_state_ = static_cast<HomeCard::State>(last_state_ + 1); | 102 last_state_ = static_cast<HomeCard::State>(last_state_ + 1); |
103 } | 103 } |
104 } | 104 } |
105 delegate_->OnGestureProgressed(last_state_, state, progress); | 105 delegate_->OnGestureProgressed(last_state_, state, progress); |
106 last_state_ = state; | 106 last_state_ = state; |
107 } | 107 } |
108 | 108 |
109 } // namespace athena | 109 } // namespace athena |
OLD | NEW |