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/views/contents_view.h" | 5 #include "ui/app_list/views/contents_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 if (pagination_model_.is_valid_page(transition.target_page)) { | 208 if (pagination_model_.is_valid_page(transition.target_page)) { |
209 target_page = transition.target_page; | 209 target_page = transition.target_page; |
210 progress = transition.progress; | 210 progress = transition.progress; |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 gfx::Rect incoming_target(rect); | 214 gfx::Rect incoming_target(rect); |
215 gfx::Rect outgoing_target(rect); | 215 gfx::Rect outgoing_target(rect); |
216 int dir = target_page > current_page ? -1 : 1; | 216 int dir = target_page > current_page ? -1 : 1; |
217 | 217 |
218 if (app_list::switches::IsExperimentalAppListEnabled()) { | 218 // The normal app list transitions vertically. |
Matt Giuca
2014/08/26 03:21:52
Replace this comment:
// Pages transition vertical
calamity
2014/08/26 03:23:50
Done.
| |
219 // The experimental app list transitions horizontally. | 219 int page_height = rect.height(); |
220 int page_width = rect.width(); | 220 int transition_offset = progress * page_height * dir; |
221 int transition_offset = progress * page_width * dir; | |
222 | 221 |
223 outgoing_target.set_x(transition_offset); | 222 outgoing_target.set_y(transition_offset); |
224 incoming_target.set_x(dir < 0 ? transition_offset + page_width | 223 incoming_target.set_y(dir < 0 ? transition_offset + page_height |
225 : transition_offset - page_width); | 224 : transition_offset - page_height); |
226 } else { | |
227 // The normal app list transitions vertically. | |
228 int page_height = rect.height(); | |
229 int transition_offset = progress * page_height * dir; | |
230 | |
231 outgoing_target.set_y(transition_offset); | |
232 incoming_target.set_y(dir < 0 ? transition_offset + page_height | |
233 : transition_offset - page_height); | |
234 } | |
235 | 225 |
236 view_model_->view_at(current_page)->SetBoundsRect(outgoing_target); | 226 view_model_->view_at(current_page)->SetBoundsRect(outgoing_target); |
237 view_model_->view_at(target_page)->SetBoundsRect(incoming_target); | 227 view_model_->view_at(target_page)->SetBoundsRect(incoming_target); |
238 } | 228 } |
239 | 229 |
240 PaginationModel* ContentsView::GetAppsPaginationModel() { | 230 PaginationModel* ContentsView::GetAppsPaginationModel() { |
241 return apps_container_view_->apps_grid_view()->pagination_model(); | 231 return apps_container_view_->apps_grid_view()->pagination_model(); |
242 } | 232 } |
243 | 233 |
244 void ContentsView::ShowFolderContent(AppListFolderItem* item) { | 234 void ContentsView::ShowFolderContent(AppListFolderItem* item) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 if (std::abs(offset) > kMinScrollToSwitchPage) { | 387 if (std::abs(offset) > kMinScrollToSwitchPage) { |
398 if (!GetAppsPaginationModel()->has_transition()) { | 388 if (!GetAppsPaginationModel()->has_transition()) { |
399 GetAppsPaginationModel()->SelectPageRelative(offset > 0 ? -1 : 1, true); | 389 GetAppsPaginationModel()->SelectPageRelative(offset > 0 ? -1 : 1, true); |
400 } | 390 } |
401 event->SetHandled(); | 391 event->SetHandled(); |
402 event->StopPropagation(); | 392 event->StopPropagation(); |
403 } | 393 } |
404 } | 394 } |
405 | 395 |
406 } // namespace app_list | 396 } // namespace app_list |
OLD | NEW |