Chromium Code Reviews| 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); |