summaryrefslogtreecommitdiffstats
path: root/ash/launcher/launcher.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 03:42:27 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 03:42:27 +0000
commit91d966a70f381e1e7e58a6b93f817838010242c3 (patch)
treec238874b217dafe557796b19bafe7fa51781be02 /ash/launcher/launcher.cc
parent4baf37d74ab7e5074499618a11669297caa17321 (diff)
downloadchromium_src-91d966a70f381e1e7e58a6b93f817838010242c3.zip
chromium_src-91d966a70f381e1e7e58a6b93f817838010242c3.tar.gz
chromium_src-91d966a70f381e1e7e58a6b93f817838010242c3.tar.bz2
ash: Change the drag resistance slightly for the shelf.
Instead of moving the shelf with the touch-point, it will expand (with some resistance), but leave the app-icons/statusbar in their original place (they can still move very slightly). BUG=145406 Review URL: https://chromiumcodereview.appspot.com/10917098 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher/launcher.cc')
-rw-r--r--ash/launcher/launcher.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index a4e01df..20902b9 100644
--- a/ash/launcher/launcher.cc
+++ b/ash/launcher/launcher.cc
@@ -5,6 +5,7 @@
#include "ash/launcher/launcher.h"
#include <algorithm>
+#include <cmath>
#include "ash/focus_cycler.h"
#include "ash/launcher/launcher_delegate.h"
@@ -81,10 +82,16 @@ void Launcher::DelegateView::Layout() {
return;
if (launcher_->alignment_ == SHELF_ALIGNMENT_BOTTOM) {
int w = std::max(0, width() - launcher_->status_size_.width());
- child_at(0)->SetBounds(0, 0, w, height());
+ int h = std::min(height(), child_at(0)->GetPreferredSize().height());
+ int move_up = height() > h ? sqrtf(height() - h) : 0;
+ child_at(0)->SetBounds(0, std::max(0, height() - h) - move_up, w, h);
} else {
int h = std::max(0, height() - launcher_->status_size_.height());
- child_at(0)->SetBounds(0, 0, width(), h);
+ int w = std::min(width(), child_at(0)->GetPreferredSize().width());
+ int x = width() > w ? sqrtf(width() - w) : 0;
+ if (launcher_->alignment_ == SHELF_ALIGNMENT_RIGHT)
+ x = width() - w - x;
+ child_at(0)->SetBounds(x, 0, w, h);
}
}