aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/toggle_button.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-05 20:54:48 +0800
committercrupest <crupest@outlook.com>2018-11-05 20:54:48 +0800
commit1dab244aaad8694ba37ef43caedd8c8ba0310c00 (patch)
treef70f6489a0f88520a0bdc095cd9713d03f83687b /src/ui/controls/toggle_button.cpp
parent252519effe30881825dd02e26dc41bd9cde34782 (diff)
downloadcru-1dab244aaad8694ba37ef43caedd8c8ba0310c00.tar.gz
cru-1dab244aaad8694ba37ef43caedd8c8ba0310c00.tar.bz2
cru-1dab244aaad8694ba37ef43caedd8c8ba0310c00.zip
...
Diffstat (limited to 'src/ui/controls/toggle_button.cpp')
-rw-r--r--src/ui/controls/toggle_button.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ui/controls/toggle_button.cpp b/src/ui/controls/toggle_button.cpp
index 3cd5d3ef..c0244bb6 100644
--- a/src/ui/controls/toggle_button.cpp
+++ b/src/ui/controls/toggle_button.cpp
@@ -1,7 +1,5 @@
#include "toggle_button.h"
-#include <fmt/format.h>
-
#include "graph/graph.h"
#include "ui/animations/animation.h"
@@ -61,12 +59,13 @@ namespace cru::ui::controls
const auto time = total_time * (std::abs(delta) / (inner_circle_x * 2));
// ReSharper disable once CppExpressionWithoutSideEffects
- AnimationBuilder(fmt::format(L"ToggleButton {}", reinterpret_cast<size_t>(this)), time)
- .AddStepHandler(CreatePtr<animations::AnimationStepHandlerPtr>([=](animations::AnimationDelegatePtr, const double percentage)
- {
- current_circle_position_ = static_cast<float>(previous_position + delta * percentage);
- Repaint();
- })).Start();
+ AnimationBuilder(Format(L"ToggleButton {}", reinterpret_cast<size_t>(this)), time)
+ .AddStepHandler([=](auto, const double percentage)
+ {
+ current_circle_position_ = static_cast<float>(previous_position + delta * percentage);
+ Repaint();
+ })
+ .Start();
RaiseToggleEvent(state);
Repaint();