Commit a652de4c authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Add elasticity to simple gesture nav

This CL adds elasticity to the simple gesture nav UI. After it reaches
the activation threshold, the affordance would be in its final shape
(full opacity, centered arrow, full ripple size), however it would still
move with further drags with diminishing speed until it completely
stops. Further drags would be ignored.

BUG=668296
TEST=manual

Change-Id: I7423e441bf90c04b84fda2cf9ddde44745bc945e
Reviewed-on: https://chromium-review.googlesource.com/559592
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488840}
parent 6f044e1b
......@@ -367,6 +367,7 @@ bool OverscrollController::ProcessOverscroll(float delta_x,
if (delegate_) {
base::Optional<float> cap = delegate_->GetMaxOverscrollDelta();
if (cap) {
DCHECK_LE(0.f, cap.value());
switch (overscroll_mode_) {
case OVERSCROLL_WEST:
case OVERSCROLL_EAST:
......
......@@ -43,6 +43,10 @@ class GestureNavSimple : public OverscrollControllerDelegate {
std::unique_ptr<Affordance> affordance_;
float completion_threshold_;
// When an overscroll is active, represents the maximum overscroll delta we
// expect in OnOverscrollUpdate().
float max_delta_;
DISALLOW_COPY_AND_ASSIGN(GestureNavSimple);
};
......
......@@ -21,6 +21,8 @@ static base::TimeDelta CalculateInterval(int frame_rate) {
return base::TimeDelta::FromMicroseconds(timer_interval);
}
const int LinearAnimation::kDefaultFrameRate = 60;
LinearAnimation::LinearAnimation(AnimationDelegate* delegate, int frame_rate)
: LinearAnimation({}, frame_rate, delegate) {}
......
......@@ -18,7 +18,7 @@ class AnimationDelegate;
class ANIMATION_EXPORT LinearAnimation : public Animation {
public:
// Default frame rate (hz).
static const int kDefaultFrameRate = 60;
static const int kDefaultFrameRate;
// Initializes everything except the duration.
//
......
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