Commit 1e4ceccc authored by Katie D's avatar Katie D Committed by Commit Bot

Clean-up: Remove unnecessary autoclick ring animation state.

The autoclick ring animation was spending 0ms in the GROWING
state and then immediately entering the SHRINKING state, where
both states were exactly the same. Removes the SHRINKING state
and switches to spend the correct amount of time animating in
GROWING.

The extra state was a holdover from an earlier version of
Autoclick which did have two animation states.

This will also increase test coverage as SHRINKING was
not covered.

TEST: manual
Relnotes: N/A
Bug: 1067399
Change-Id: I2e349ee4cca8c10c7753b8b37ac8cf3ab2696fe8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134393Reviewed-by: default avatarAnastasia Helfinstein <anastasi@google.com>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Auto-Submit: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756299}
parent 17ccd40a
......@@ -112,12 +112,6 @@ class AutoclickRingHandler::AutoclickRingView : public views::View {
SchedulePaint();
}
void UpdateWithShrinkAnimation(gfx::Animation* animation) {
current_angle_ = animation->CurrentValueBetween(
kAutoclickRingAngleStartValue, kAutoclickRingAngleEndValue);
SchedulePaint();
}
void SetSize(int radius) { radius_ = radius; }
private:
......@@ -166,7 +160,7 @@ void AutoclickRingHandler::StartGesture(
ring_widget_ = widget;
current_animation_type_ = AnimationType::GROW_ANIMATION;
animation_duration_ = duration;
StartAnimation(base::TimeDelta());
StartAnimation(animation_duration_);
}
void AutoclickRingHandler::StopGesture() {
......@@ -197,13 +191,6 @@ void AutoclickRingHandler::StartAnimation(base::TimeDelta delay) {
Start();
break;
}
case AnimationType::SHRINK_ANIMATION: {
view_.reset(
new AutoclickRingView(tap_down_location_, ring_widget_, radius_));
SetDuration(delay);
Start();
break;
}
case AnimationType::NONE:
NOTREACHED();
break;
......@@ -226,10 +213,6 @@ void AutoclickRingHandler::AnimateToState(double state) {
view_->SetLocation(tap_down_location_);
view_->UpdateWithGrowAnimation(this);
break;
case AnimationType::SHRINK_ANIMATION:
view_->SetLocation(tap_down_location_);
view_->UpdateWithShrinkAnimation(this);
break;
case AnimationType::NONE:
NOTREACHED();
break;
......@@ -239,14 +222,10 @@ void AutoclickRingHandler::AnimateToState(double state) {
void AutoclickRingHandler::AnimationStopped() {
switch (current_animation_type_) {
case AnimationType::GROW_ANIMATION:
current_animation_type_ = AnimationType::SHRINK_ANIMATION;
StartAnimation(animation_duration_);
break;
case AnimationType::SHRINK_ANIMATION:
current_animation_type_ = AnimationType::NONE;
break;
case AnimationType::NONE:
// fall through to reset the view.
// Fall through to reset the view.
view_.reset();
break;
}
......
......@@ -14,8 +14,8 @@
namespace ash {
// AutoclickRingHandler displays an animated affordance that is shown
// on autoclick gesture. The animation sequence consists of two circles which
// shrink towards the spot the autoclick will generate a mouse event.
// on autoclick gesture. The animation is a semi-transparent ring which
// fills with white.
class AutoclickRingHandler : public gfx::LinearAnimation {
public:
AutoclickRingHandler();
......@@ -36,7 +36,6 @@ class AutoclickRingHandler : public gfx::LinearAnimation {
enum class AnimationType {
NONE,
GROW_ANIMATION,
SHRINK_ANIMATION,
};
void StartAnimation(base::TimeDelta 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