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

Unified Diff: ui/aura_shell/workspace/workspace_manager.cc

Issue 8399027: Makes overview center the active workspace. This avoids leaving extra (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
« no previous file with comments | « ui/aura_shell/workspace/workspace.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/workspace/workspace_manager.cc
diff --git a/ui/aura_shell/workspace/workspace_manager.cc b/ui/aura_shell/workspace/workspace_manager.cc
index 410ace11474528ced8138181083bd90fb09c7f42..1a4836c929df1a5fbf965ca920a981be6f9b0578 100644
--- a/ui/aura_shell/workspace/workspace_manager.cc
+++ b/ui/aura_shell/workspace/workspace_manager.cc
@@ -92,7 +92,6 @@ void WorkspaceManager::SetOverview(bool overview) {
if (is_overview_ == overview)
return;
is_overview_ = overview;
- gfx::Rect bounds = viewport_->GetTargetBounds();
ui::Transform transform;
if (is_overview_) {
@@ -108,8 +107,16 @@ void WorkspaceManager::SetOverview(bool overview) {
transform.SetScale(scale, scale);
int overview_width = viewport_->bounds().width() * scale;
- int dx = overview_width < workspace_size_.width() ?
- (workspace_size_.width() - overview_width) / 2 : 0;
+ int dx = 0;
+ if (overview_width < workspace_size_.width()) {
+ dx = (workspace_size_.width() - overview_width) / 2;
+ } else if (active_workspace_) {
+ // Center the active workspace.
+ int active_workspace_mid_x = (active_workspace_->bounds().x() +
+ active_workspace_->bounds().width() / 2) * scale;
+ dx = workspace_size_.width() / 2 - active_workspace_mid_x;
+ dx = std::min(0, std::max(dx, workspace_size_.width() - overview_width));
+ }
transform.SetTranslateX(-viewport_->GetTargetBounds().x() + dx);
oshima 2011/10/27 08:43:05 can you remove -viewport->GetTargetBounds().x().?
transform.SetTranslateY(workspace_size_.height() * (1.0f - scale) / 2);
« no previous file with comments | « ui/aura_shell/workspace/workspace.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698