OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/app_list/pagination_model.h" | 5 #include "ui/app_list/pagination_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ui/app_list/pagination_model_observer.h" | 9 #include "ui/app_list/pagination_model_observer.h" |
10 #include "ui/base/animation/slide_animation.h" | 10 #include "ui/base/animation/slide_animation.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 transition_.target_page = CalculateTargetPage(page_change_dir); | 100 transition_.target_page = CalculateTargetPage(page_change_dir); |
101 | 101 |
102 // Updates transition progress. | 102 // Updates transition progress. |
103 int transition_dir = transition_.target_page > selected_page_ ? 1 : -1; | 103 int transition_dir = transition_.target_page > selected_page_ ? 1 : -1; |
104 double progress = transition_.progress + | 104 double progress = transition_.progress + |
105 fabs(delta) * page_change_dir * transition_dir; | 105 fabs(delta) * page_change_dir * transition_dir; |
106 | 106 |
107 if (progress < 0) { | 107 if (progress < 0) { |
108 clear_transition(); | 108 clear_transition(); |
109 } else if (progress > 1) { | 109 } else if (progress > 1) { |
110 if (is_valid_page(transition_.target_page)) | 110 if (is_valid_page(transition_.target_page)) { |
111 SelectPage(transition_.target_page, false); | 111 SelectPage(transition_.target_page, false); |
112 clear_transition(); | 112 clear_transition(); |
| 113 } |
113 } else { | 114 } else { |
114 transition_.progress = progress; | 115 transition_.progress = progress; |
115 NotifyTransitionChanged(); | 116 NotifyTransitionChanged(); |
116 } | 117 } |
117 } | 118 } |
118 | 119 |
119 void PaginationModel::EndScroll() { | 120 void PaginationModel::EndScroll() { |
120 if (!has_transition()) | 121 if (!has_transition()) |
121 return; | 122 return; |
122 | 123 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } else if (transition_animation_->GetCurrentValue() == 0) { | 218 } else if (transition_animation_->GetCurrentValue() == 0) { |
218 // Hiding animation ends. No page change should happen. | 219 // Hiding animation ends. No page change should happen. |
219 ResetTranstionAnimation(); | 220 ResetTranstionAnimation(); |
220 } | 221 } |
221 | 222 |
222 if (next_target >= 0) | 223 if (next_target >= 0) |
223 SelectPage(next_target, true); | 224 SelectPage(next_target, true); |
224 } | 225 } |
225 | 226 |
226 } // namespace app_list | 227 } // namespace app_list |
OLD | NEW |