Added ability to pass animation type to SlideWrap.

This commit is contained in:
23rd 2021-07-12 18:42:52 +03:00
parent b8485c0d8a
commit 9c552215ab
2 changed files with 11 additions and 6 deletions

View file

@ -80,11 +80,12 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::finishAnimating() {
}
SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleOn(
rpl::producer<bool> &&shown) {
rpl::producer<bool> &&shown,
anim::type animated) {
std::move(
shown
) | rpl::start_with_next([this](bool shown) {
toggle(shown, anim::type::normal);
) | rpl::start_with_next([=](bool shown) {
toggle(shown, animated);
}, lifetime());
finishAnimating();
return this;

View file

@ -39,7 +39,9 @@ public:
return toggle(false, animated);
}
SlideWrap *finishAnimating();
SlideWrap *toggleOn(rpl::producer<bool> &&shown);
SlideWrap *toggleOn(
rpl::producer<bool> &&shown,
anim::type animated = anim::type::normal);
bool animating() const {
return _animation.animating();
@ -104,8 +106,10 @@ public:
SlideWrap *finishAnimating() {
return chain(Parent::finishAnimating());
}
SlideWrap *toggleOn(rpl::producer<bool> &&shown) {
return chain(Parent::toggleOn(std::move(shown)));
SlideWrap *toggleOn(
rpl::producer<bool> &&shown,
anim::type animated = anim::type::normal) {
return chain(Parent::toggleOn(std::move(shown), animated));
}
private: