Skip to content

Commit

Permalink
Fixed. Animation not set properly at construction to stopped state.
Browse files Browse the repository at this point in the history
  • Loading branch information
djowel committed Jun 29, 2024
1 parent 10dcc58 commit 4c4ff79
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
7 changes: 1 addition & 6 deletions lib/include/elements/element/status_bar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ namespace cycfi::elements
busy_bar_base(
double init_value = 0.0
, double start_pos = 0.0
)
: status_bar_base(init_value)
, _start_pos(start_pos)
, _animation_width(-0.2)
, _status(_animation_width)
{}
);

void start_pos(double val);
double start_pos() const { return _start_pos; }
Expand Down
17 changes: 15 additions & 2 deletions lib/src/element/status_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ namespace cycfi::elements
return bounds;
}

using namespace std::chrono_literals;

busy_bar_base::busy_bar_base(
double init_value
, double start_pos
)
: status_bar_base{init_value}
, _start_pos{start_pos}
, _animation_width{-0.2}
, _status{_status = -1 * _animation_width}
, _time{0ms}
{
}

// Implement the start method as per the patch
void busy_bar_base::start_pos(double val)
{
Expand Down Expand Up @@ -120,13 +134,12 @@ namespace cycfi::elements
{
bool should_start = is_stopped();
_time = time;
if(should_start)
if (should_start)
animate(view_);
}

void busy_bar_base::stop(view& view_)
{
using namespace std::chrono_literals;
_time = 0ms;
animate(view_);
}
Expand Down

0 comments on commit 4c4ff79

Please sign in to comment.