Commit 855591c5 authored by Jennifer Apacible's avatar Jennifer Apacible Committed by Commit Bot

[OverlayWindowViews] Update comments for control positioning.

Change-Id: I1839a621a3b7b92dfbdef896675c3e3384399601
Reviewed-on: https://chromium-review.googlesource.com/1246591
Commit-Queue: apacible <apacible@chromium.org>
Reviewed-by: default avatarCJ DiMeglio <lethalantidote@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594543}
parent 48e5eb8e
......@@ -439,10 +439,16 @@ gfx::Rect OverlayWindowViews::CalculateControlsBounds(int x,
void OverlayWindowViews::UpdateControlsPositions() {
int mid_window_x = GetBounds().size().width() / 2;
// The controls should always be centered, regardless of how many there are.
// When there are only two controls, make them symmetric from the center.
// __________________________
// | |
// | |
// | [1] [P] |
// | |
// |__________________________|
if (OnlyOneCustomControlAdded()) {
// Draw |first_custom_controls_view_| to the left of
// |play_pause_controls_view_| and offset both so they are centered on the
// screen.
play_pause_controls_view_->SetBoundsRect(
CalculateControlsBounds(mid_window_x, button_size_));
first_custom_controls_view_->SetBoundsRect(CalculateControlsBounds(
......@@ -450,13 +456,19 @@ void OverlayWindowViews::UpdateControlsPositions() {
return;
}
// Place the play / pause control in the center of the window. If both custom
// controls are specified, place them on either side to maintain the balance,
// from left to right.
// __________________________
// | |
// | |
// | [1] [P] [2] |
// | |
// |__________________________|
play_pause_controls_view_->SetBoundsRect(CalculateControlsBounds(
mid_window_x - button_size_.width() / 2, button_size_));
if (first_custom_controls_view_ && second_custom_controls_view_) {
// Draw |first_custom_controls_view_| to the left and
// |second_custom_controls_view_| to the right of
// |play_pause_controls_view_|.
first_custom_controls_view_->SetBoundsRect(CalculateControlsBounds(
mid_window_x - button_size_.width() / 2 - button_size_.width(),
button_size_));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment