Bug 772436 - Fix rounding errors in slide to close tabs. r=mfinkle

This commit is contained in:
Wes Johnston 2012-07-10 11:17:21 -07:00
parent 1953f2f366
commit f3dcbb67ab

View File

@ -344,11 +344,11 @@ public class TabsTray extends LinearLayout
// if the user was dragging horizontally, check to see if we should close the tab
if (dir == DragDirection.HORIZONTAL) {
int finalPos = 0;
// if the swipe started on the left and ended in the right 1/4 of the tray
// if the swipe started on the left and ended in the right 25% of the tray
// or vice versa, close the tab
if ((start.x > mList.getWidth() / 2 && e.getX() < mList.getWidth() / 4)) {
if ((start.x > mList.getWidth() / 2 && e.getX() < mList.getWidth() * 0.25 )) {
finalPos = -1 * mView.getWidth();
} else if (start.x < mList.getWidth() / 2 && e.getX() > mList.getWidth() * (3 / 4)) {
} else if (start.x < mList.getWidth() / 2 && e.getX() > mList.getWidth() * 0.75) {
finalPos = mView.getWidth();
}