diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 00:37:15 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 00:37:15 +0000 |
commit | 553aabb40b432ecdc2c289c935ba77874928dfcc (patch) | |
tree | 7ecabde66cc28677bc092a715c2a1228cac80ba5 /app/multi_animation.cc | |
parent | 2ca83cd871de1a2c322a48b80d06f4d3c8bb6923 (diff) | |
download | chromium_src-553aabb40b432ecdc2c289c935ba77874928dfcc.zip chromium_src-553aabb40b432ecdc2c289c935ba77874928dfcc.tar.gz chromium_src-553aabb40b432ecdc2c289c935ba77874928dfcc.tar.bz2 |
Makes the instant suggested text autocomplete after 1.3 seconds. There
are a number of parts of this patch that need work, but it should be
good enough for us to decide if we want to pursue it.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/4385001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/multi_animation.cc')
-rw-r--r-- | app/multi_animation.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/multi_animation.cc b/app/multi_animation.cc index 11ca6f8..812a668 100644 --- a/app/multi_animation.cc +++ b/app/multi_animation.cc @@ -21,7 +21,8 @@ MultiAnimation::MultiAnimation(const Parts& parts) parts_(parts), cycle_time_ms_(TotalTime(parts)), current_value_(0), - current_part_index_(0) { + current_part_index_(0), + continuous_(true) { DCHECK(!parts_.empty()); } @@ -31,8 +32,14 @@ void MultiAnimation::Step(base::TimeTicks time_now) { double last_value = current_value_; size_t last_index = current_part_index_; - int delta = static_cast<int>((time_now - start_time()).InMilliseconds() % - cycle_time_ms_); + int delta = static_cast<int>((time_now - start_time()).InMilliseconds()); + if (delta >= cycle_time_ms_ && !continuous_) { + current_part_index_ = parts_.size() - 1; + current_value_ = Tween::CalculateValue(parts_[current_part_index_].type, 1); + Stop(); + return; + } + delta %= cycle_time_ms_; const Part& part = GetPart(&delta, ¤t_part_index_); double percent = static_cast<double>(delta + part.start_time_ms) / static_cast<double>(part.end_time_ms); |