From 1dab244aaad8694ba37ef43caedd8c8ba0310c00 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 5 Nov 2018 20:54:48 +0800 Subject: ... --- src/ui/controls/toggle_button.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/ui/controls/toggle_button.cpp') 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 - #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(this)), time) - .AddStepHandler(CreatePtr([=](animations::AnimationDelegatePtr, const double percentage) - { - current_circle_position_ = static_cast(previous_position + delta * percentage); - Repaint(); - })).Start(); + AnimationBuilder(Format(L"ToggleButton {}", reinterpret_cast(this)), time) + .AddStepHandler([=](auto, const double percentage) + { + current_circle_position_ = static_cast(previous_position + delta * percentage); + Repaint(); + }) + .Start(); RaiseToggleEvent(state); Repaint(); -- cgit v1.2.3