Animate Info-to-Info transitions.

This commit is contained in:
John Preston 2017-10-03 15:57:11 +01:00
parent 93c15e5ee6
commit c6c75a1980
16 changed files with 128 additions and 131 deletions

View File

@ -125,12 +125,17 @@ rpl::producer<int> ContentWidget::desiredHeightValue() const {
return value + _scrollTopSkip; return value + _scrollTopSkip;
}); });
} }
rpl::producer<bool> ContentWidget::desiredShadowVisibility() const { rpl::producer<bool> ContentWidget::desiredShadowVisibility() const {
using namespace rpl::mappers; using namespace rpl::mappers;
return _scroll->scrollTopValue() return _scroll->scrollTopValue()
| rpl::map($1 > 0); | rpl::map($1 > 0);
} }
bool ContentWidget::hasTopBarShadow() const {
return (_scroll->scrollTop() > 0);
}
int ContentWidget::scrollTopSave() const { int ContentWidget::scrollTopSave() const {
return _scroll->scrollTop(); return _scroll->scrollTop();
} }

View File

@ -62,6 +62,7 @@ public:
rpl::producer<int> desiredHeightValue() const override; rpl::producer<int> desiredHeightValue() const override;
rpl::producer<bool> desiredShadowVisibility() const; rpl::producer<bool> desiredShadowVisibility() const;
bool hasTopBarShadow() const;
virtual void setInnerFocus() { virtual void setInnerFocus() {
_inner->setFocus(); _inner->setFocus();

View File

@ -57,7 +57,7 @@ LayerWidget::LayerWidget(
void LayerWidget::setupHeightConsumers() { void LayerWidget::setupHeightConsumers() {
_content->desiredHeightValue() _content->desiredHeightValue()
| rpl::start_with_next([this](int height) { | rpl::start_with_next([this](int height) {
_desiredHeight = height; accumulate_max(_desiredHeight, height);
resizeToWidth(width()); resizeToWidth(width());
}, lifetime()); }, lifetime());
} }

View File

@ -56,7 +56,7 @@ void SectionWidget::init() {
} }
PeerData *SectionWidget::peerForDialogs() const { PeerData *SectionWidget::peerForDialogs() const {
return _content->peer(); return _content->peerForDialogs();
} }
bool SectionWidget::hasTopBarShadow() const { bool SectionWidget::hasTopBarShadow() const {
@ -73,7 +73,7 @@ void SectionWidget::doSetInnerFocus() {
} }
void SectionWidget::showFinishedHook() { void SectionWidget::showFinishedHook() {
_content->showFinished(); _content->showFast();
} }
bool SectionWidget::showInternal( bool SectionWidget::showInternal(

View File

@ -47,7 +47,6 @@ public:
Wrap wrap, Wrap wrap,
not_null<MoveMemento*> memento); not_null<MoveMemento*> memento);
not_null<PeerData*> peer() const;
PeerData *peerForDialogs() const override; PeerData *peerForDialogs() const override;
bool hasTopBarShadow() const override; bool hasTopBarShadow() const override;

View File

@ -49,7 +49,7 @@ void TopBar::enableBackButton(bool enable) {
if (enable) { if (enable) {
_back.create(this, _st.back); _back.create(this, _st.back);
_back->clicks() _back->clicks()
| rpl::start_to_stream(_backClicks, lifetime()); | rpl::start_to_stream(_backClicks, _back->lifetime());
} else { } else {
_back.destroy(); _back.destroy();
} }

View File

@ -50,9 +50,8 @@ WrapWidget::WrapWidget(
not_null<Window::Controller*> controller, not_null<Window::Controller*> controller,
Wrap wrap, Wrap wrap,
not_null<Memento*> memento) not_null<Memento*> memento)
: RpWidget(parent) : SectionWidget(parent, controller)
, _wrap(wrap) , _wrap(wrap)
, _controller(controller)
, _topShadow(this) { , _topShadow(this) {
_topShadow->toggleOn(topShadowToggledValue()); _topShadow->toggleOn(topShadowToggledValue());
showNewContent(memento->content()); showNewContent(memento->content());
@ -89,6 +88,14 @@ void WrapWidget::createTabs() {
_topTabs->move(0, 0); _topTabs->move(0, 0);
_topTabs->resizeToWidth(width()); _topTabs->resizeToWidth(width());
_topTabs->show(); _topTabs->show();
_topTabsBackground.create(this, st::profileBg);
_topTabsBackground->move(0, 0);
_topTabsBackground->resize(
width(),
_topTabs->height() - st::lineWidth);
_topTabsBackground->show();
} }
void WrapWidget::showTab(Tab tab) { void WrapWidget::showTab(Tab tab) {
@ -156,10 +163,9 @@ void WrapWidget::createTopBar(
auto close = _topBar->addButton(object_ptr<Ui::IconButton>( auto close = _topBar->addButton(object_ptr<Ui::IconButton>(
_topBar, _topBar,
st::infoLayerTopBarClose)); st::infoLayerTopBarClose));
close->clicks() close->addClickHandler([this] {
| rpl::start_with_next([this] { controller()->hideSpecialLayer();
_controller->hideSpecialLayer(); });
}, close->lifetime());
} }
_topBar->move(0, 0); _topBar->move(0, 0);
@ -178,39 +184,20 @@ void WrapWidget::showBackFromStack() {
last.section.get(), last.section.get(),
params); params);
} else { } else {
_controller->showBackFromStack(params); controller()->showBackFromStack(params);
} }
} }
not_null<Ui::RpWidget*> WrapWidget::topWidget() const { not_null<Ui::RpWidget*> WrapWidget::topWidget() const {
if (_topTabs) { if (_topTabs) {
return _topTabs; return _topTabsBackground;
} }
return _topBar; return _topBar;
} }
int WrapWidget::topHeightAddition() const {
return _topTabs ? -st::lineWidth : 0;
}
int WrapWidget::topHeight() const {
return topWidget()->height() + topHeightAddition();
}
rpl::producer<int> WrapWidget::topHeightValue() const {
using namespace rpl::mappers;
return topWidget()->heightValue()
| rpl::map($1 + topHeightAddition());
}
void WrapWidget::showContent(object_ptr<ContentWidget> content) { void WrapWidget::showContent(object_ptr<ContentWidget> content) {
_content = std::move(content); _content = std::move(content);
_content->show(); _content->show();
_topShadow->raise();
if (_topTabs) {
_topTabs->raise();
}
finishShowContent(); finishShowContent();
} }
@ -218,10 +205,12 @@ void WrapWidget::finishShowContent() {
updateContentGeometry(); updateContentGeometry();
_desiredHeights.fire(desiredHeightForContent()); _desiredHeights.fire(desiredHeightForContent());
_desiredShadowVisibilities.fire(_content->desiredShadowVisibility()); _desiredShadowVisibilities.fire(_content->desiredShadowVisibility());
_topShadow->raise();
_topShadow->finishAnimating();
if (_topTabs) { if (_topTabs) {
_topTabs->raise();
_topTabs->finishAnimating(); _topTabs->finishAnimating();
} }
_topShadow->finishAnimating();
} }
rpl::producer<bool> WrapWidget::topShadowToggledValue() const { rpl::producer<bool> WrapWidget::topShadowToggledValue() const {
@ -236,7 +225,7 @@ rpl::producer<int> WrapWidget::desiredHeightForContent() const {
using namespace rpl::mappers; using namespace rpl::mappers;
return rpl::combine( return rpl::combine(
_content->desiredHeightValue(), _content->desiredHeightValue(),
topHeightValue(), topWidget()->heightValue(),
$1 + $2); $1 + $2);
} }
@ -282,17 +271,23 @@ bool WrapWidget::hasTopBarShadow() const {
QPixmap WrapWidget::grabForShowAnimation( QPixmap WrapWidget::grabForShowAnimation(
const Window::SectionSlideParams &params) { const Window::SectionSlideParams &params) {
if (params.withTopBarShadow) _topShadow->hide(anim::type::instant); if (params.withTopBarShadow) {
_topShadow->setVisible(false);
} else {
_topShadow->toggle(_topShadow->toggled(), anim::type::instant);
}
auto result = myGrab(this); auto result = myGrab(this);
if (params.withTopBarShadow) _topShadow->show(anim::type::instant); if (params.withTopBarShadow) _topShadow->setVisible(true);
return result; return result;
} }
void WrapWidget::setInnerFocus() { void WrapWidget::doSetInnerFocus() {
_content->setInnerFocus(); _content->setInnerFocus();
} }
void WrapWidget::showFinished() { void WrapWidget::showFinishedHook() {
// Restore shadow visibility after showChildren() call.
_topShadow->toggle(_topShadow->toggled(), anim::type::instant);
} }
bool WrapWidget::showInternal( bool WrapWidget::showInternal(
@ -328,7 +323,7 @@ void WrapWidget::saveState(not_null<Memento*> memento) {
} }
QRect WrapWidget::contentGeometry() const { QRect WrapWidget::contentGeometry() const {
return rect().marginsRemoved({ 0, topHeight(), 0, 0 }); return rect().marginsRemoved({ 0, topWidget()->height(), 0, 0 });
} }
void WrapWidget::showNewContent( void WrapWidget::showNewContent(
@ -336,14 +331,15 @@ void WrapWidget::showNewContent(
const Window::SectionShow &params) { const Window::SectionShow &params) {
auto saveToStack = (_content != nullptr) auto saveToStack = (_content != nullptr)
&& (params.way == Window::SectionShow::Way::Forward); && (params.way == Window::SectionShow::Way::Forward);
auto showAnimated = (_content != nullptr) auto needAnimation = (_content != nullptr)
&& (params.animated != anim::type::instant); && (params.animated != anim::type::instant);
if (showAnimated) { auto animationParams = SectionSlideParams();
if (needAnimation) {
auto newContent = createContent(memento); auto newContent = createContent(memento);
auto params = SectionSlideParams(); animationParams.withTopBarShadow = hasTopBarShadow()
// params.withTopBarShadow = newContent; && newContent->hasTopBarShadow();
} else { animationParams.oldContentCache = grabForShowAnimation(
animationParams);
} }
if (saveToStack) { if (saveToStack) {
auto item = StackItem(); auto item = StackItem();
@ -356,6 +352,13 @@ void WrapWidget::showNewContent(
_historyStack.clear(); _historyStack.clear();
} }
showNewContent(memento); showNewContent(memento);
if (animationParams) {
showAnimated(
saveToStack
? SlideDirection::FromRight
: SlideDirection::FromLeft,
animationParams);
}
} }
void WrapWidget::showNewContent(not_null<ContentMemento*> memento) { void WrapWidget::showNewContent(not_null<ContentMemento*> memento) {
@ -368,6 +371,7 @@ void WrapWidget::setupTabs(Tab tab) {
_tab = tab; _tab = tab;
if (_tab == Tab::None) { if (_tab == Tab::None) {
_topTabs.destroy(); _topTabs.destroy();
_topTabsBackground.destroy();
} else if (!_topTabs) { } else if (!_topTabs) {
createTabs(); createTabs();
} else { } else {
@ -376,23 +380,25 @@ void WrapWidget::setupTabs(Tab tab) {
} }
void WrapWidget::resizeEvent(QResizeEvent *e) { void WrapWidget::resizeEvent(QResizeEvent *e) {
topWidget()->resizeToWidth(width()); if (_topTabs) {
_topTabs->resizeToWidth(width());
_topTabsBackground->resize(
width(),
_topTabs->height() - st::lineWidth);
} else if (_topBar) {
_topBar->resizeToWidth(width());
}
updateContentGeometry(); updateContentGeometry();
} }
void WrapWidget::updateContentGeometry() { void WrapWidget::updateContentGeometry() {
if (_content) { if (_content) {
_topShadow->resizeToWidth(width()); _topShadow->resizeToWidth(width());
_topShadow->moveToLeft(0, topHeight()); _topShadow->moveToLeft(0, topWidget()->height());
_content->setGeometry(contentGeometry()); _content->setGeometry(contentGeometry());
} }
} }
void WrapWidget::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(e->rect(), st::profileBg);
}
bool WrapWidget::wheelEventFromFloatPlayer(QEvent *e) { bool WrapWidget::wheelEventFromFloatPlayer(QEvent *e) {
return _content->wheelEventFromFloatPlayer(e); return _content->wheelEventFromFloatPlayer(e);
} }

View File

@ -27,6 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
class SettingsSlider; class SettingsSlider;
class FadeShadow; class FadeShadow;
class PlainShadow;
} // namespace Ui } // namespace Ui
namespace Window { namespace Window {
@ -86,7 +87,7 @@ private:
}; };
class WrapWidget final : public Ui::RpWidget { class WrapWidget final : public Window::SectionWidget {
public: public:
WrapWidget( WrapWidget(
QWidget *parent, QWidget *parent,
@ -95,39 +96,38 @@ public:
not_null<Memento*> memento); not_null<Memento*> memento);
not_null<PeerData*> peer() const; not_null<PeerData*> peer() const;
PeerData *peerForDialogs() const override {
return peer();
}
Wrap wrap() const; Wrap wrap() const;
void setWrap(Wrap wrap); void setWrap(Wrap wrap);
bool hasTopBarShadow() const; bool hasTopBarShadow() const override;
QPixmap grabForShowAnimation( QPixmap grabForShowAnimation(
const Window::SectionSlideParams &params); const Window::SectionSlideParams &params) override;
bool showInternal( bool showInternal(
not_null<Window::SectionMemento*> memento, not_null<Window::SectionMemento*> memento,
const Window::SectionShow &params); const Window::SectionShow &params) override;
std::unique_ptr<Window::SectionMemento> createMemento(); std::unique_ptr<Window::SectionMemento> createMemento() override;
rpl::producer<int> desiredHeightValue() const; rpl::producer<int> desiredHeightValue() const;
void setInnerFocus();
void showFinished();
void updateInternalState(not_null<Memento*> memento); void updateInternalState(not_null<Memento*> memento);
void saveState(not_null<Memento*> memento); void saveState(not_null<Memento*> memento);
// Float player interface. // Float player interface.
bool wheelEventFromFloatPlayer(QEvent *e); bool wheelEventFromFloatPlayer(QEvent *e) override;
QRect rectForFloatPlayer() const; QRect rectForFloatPlayer() const override;
~WrapWidget(); ~WrapWidget();
protected: protected:
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
void paintEvent(QPaintEvent *e);
not_null<Window::Controller*> controller() const { void doSetInnerFocus() override;
return _controller; void showFinishedHook() override;
}
private: private:
using SlideDirection = Window::SlideDirection; using SlideDirection = Window::SlideDirection;
@ -153,9 +153,6 @@ private:
PeerId peerId); PeerId peerId);
not_null<RpWidget*> topWidget() const; not_null<RpWidget*> topWidget() const;
int topHeightAddition() const;
int topHeight() const;
rpl::producer<int> topHeightValue() const;
QRect contentGeometry() const; QRect contentGeometry() const;
rpl::producer<int> desiredHeightForContent() const; rpl::producer<int> desiredHeightForContent() const;
@ -172,8 +169,8 @@ private:
not_null<ContentMemento*> memento); not_null<ContentMemento*> memento);
rpl::variable<Wrap> _wrap; rpl::variable<Wrap> _wrap;
not_null<Window::Controller*> _controller;
object_ptr<ContentWidget> _content = { nullptr }; object_ptr<ContentWidget> _content = { nullptr };
object_ptr<Ui::PlainShadow> _topTabsBackground = { nullptr };
object_ptr<Ui::SettingsSlider> _topTabs = { nullptr }; object_ptr<Ui::SettingsSlider> _topTabs = { nullptr };
object_ptr<TopBar> _topBar = { nullptr }; object_ptr<TopBar> _topBar = { nullptr };
object_ptr<Ui::FadeShadow> _topShadow; object_ptr<Ui::FadeShadow> _topShadow;

View File

@ -51,10 +51,9 @@ Button *Button::toggleOn(rpl::producer<bool> &&toggled) {
isOver() ? _st.toggleOver : _st.toggle, isOver() ? _st.toggleOver : _st.toggle,
false, false,
[this] { rtlupdate(toggleRect()); }); [this] { rtlupdate(toggleRect()); });
clicks() addClickHandler([this] {
| rpl::start_with_next([this] {
_toggle->setCheckedAnimated(!_toggle->checked()); _toggle->setCheckedAnimated(!_toggle->checked());
}, lifetime()); });
std::move(toggled) std::move(toggled)
| rpl::start_with_next([this](bool toggled) { | rpl::start_with_next([this](bool toggled) {
_toggle->setCheckedAnimated(toggled); _toggle->setCheckedAnimated(toggled);

View File

@ -204,14 +204,13 @@ object_ptr<Ui::RpWidget> InnerWidget::setupMuteToggle(
st::infoNotificationsButton); st::infoNotificationsButton);
result->toggleOn( result->toggleOn(
NotificationsEnabledValue(_peer) NotificationsEnabledValue(_peer)
)->clicks() )->addClickHandler([this] {
| rpl::start_with_next([this] {
App::main()->updateNotifySetting( App::main()->updateNotifySetting(
_peer, _peer,
_peer->isMuted() _peer->isMuted()
? NotifySettingSetNotify ? NotifySettingSetNotify
: NotifySettingSetMuted); : NotifySettingSetMuted);
}, result->lifetime()); });
object_ptr<FloatingIcon>( object_ptr<FloatingIcon>(
result, result,
st::infoIconNotifications, st::infoIconNotifications,
@ -240,26 +239,24 @@ void InnerWidget::setupUserButtons(
)->toggleOn( )->toggleOn(
_controller->historyPeer.value() _controller->historyPeer.value()
| rpl::map($1 != user) | rpl::map($1 != user)
)->entity()->clicks() )->entity()->addClickHandler([this, user] {
| rpl::start_with_next([this, user] {
_controller->showPeerHistory( _controller->showPeerHistory(
user, user,
Window::SectionShow::Way::Forward); Window::SectionShow::Way::Forward);
}, wrap->lifetime()); });
addButton( addButton(
Lang::Viewer(lng_info_add_as_contact) | ToUpperValue() Lang::Viewer(lng_info_add_as_contact) | ToUpperValue()
)->toggleOn( )->toggleOn(
CanAddContactValue(user) CanAddContactValue(user)
)->entity()->clicks() )->entity()->addClickHandler([user] {
| rpl::start_with_next([user] {
auto firstName = user->firstName; auto firstName = user->firstName;
auto lastName = user->lastName; auto lastName = user->lastName;
auto phone = user->phone().isEmpty() auto phone = user->phone().isEmpty()
? App::phoneFromSharedContact(user->bareId()) ? App::phoneFromSharedContact(user->bareId())
: user->phone(); : user->phone();
Ui::show(Box<AddContactBox>(firstName, lastName, phone)); Ui::show(Box<AddContactBox>(firstName, lastName, phone));
}, wrap->lifetime()); });
topSkip->toggleOn(std::move(tracker).atLeastOneShownValue()); topSkip->toggleOn(std::move(tracker).atLeastOneShownValue());
} }
@ -311,10 +308,9 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
[phrase = mediaText(type)](int count) { [phrase = mediaText(type)](int count) {
return phrase(lt_count, count); return phrase(lt_count, count);
} }
)->entity()->clicks() )->entity()->addClickHandler([peer = _peer, type] {
| rpl::start_with_next([peer = _peer, type] {
SharedMediaShowOverview(type, App::history(peer)); SharedMediaShowOverview(type, App::history(peer));
}, content->lifetime()); });
}; };
auto addCommonGroupsButton = [&](not_null<UserData*> user) { auto addCommonGroupsButton = [&](not_null<UserData*> user) {
return addButton( return addButton(
@ -322,12 +318,11 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
[](int count) { [](int count) {
return lng_profile_common_groups(lt_count, count); return lng_profile_common_groups(lt_count, count);
} }
)->entity()->clicks() )->entity()->addClickHandler([this, peer = _peer] {
| rpl::start_with_next([this, peer = _peer] {
_controller->showSection( _controller->showSection(
::Profile::CommonGroups::SectionMemento( ::Profile::CommonGroups::SectionMemento(
peer->asUser())); peer->asUser()));
}, content->lifetime()); });
}; };
addMediaButton(MediaType::Photo); addMediaButton(MediaType::Photo);
addMediaButton(MediaType::Video); addMediaButton(MediaType::Video);
@ -388,10 +383,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupUserActions(
st)) st))
)->toggleOn( )->toggleOn(
std::move(toggleOn) std::move(toggleOn)
)->entity()->clicks() )->entity()->addClickHandler(std::move(callback));
| rpl::start_with_next([callback = std::move(callback)] {
callback();
}, result->lifetime());
}; };
addButton( addButton(

View File

@ -117,24 +117,21 @@ void Members::setupButtons() {
newWidth); newWidth);
}, _addMember->lifetime()); }, _addMember->lifetime());
_addMember->showOn(rpl::duplicate(addMemberShown)); _addMember->showOn(rpl::duplicate(addMemberShown));
_addMember->clicks() // TODO throttle(ripple duration) _addMember->addClickHandler([this] { // TODO throttle(ripple duration)
| rpl::start_with_next([this] {
this->addMember(); this->addMember();
}, _addMember->lifetime()); });
auto searchShown = MembersCountValue(_peer) auto searchShown = MembersCountValue(_peer)
| rpl::map($1 >= kEnableSearchMembersAfterCount) | rpl::map($1 >= kEnableSearchMembersAfterCount)
| rpl::distinct_until_changed() | rpl::distinct_until_changed()
| rpl::start_spawning(lifetime()); | rpl::start_spawning(lifetime());
_search->showOn(rpl::duplicate(searchShown)); _search->showOn(rpl::duplicate(searchShown));
_search->clicks() _search->addClickHandler([this] {
| rpl::start_with_next([this] {
this->showSearch(); this->showSearch();
}, _search->lifetime()); });
_cancelSearch->clicks() _cancelSearch->addClickHandler([this] {
| rpl::start_with_next([this] {
this->cancelSearch(); this->cancelSearch();
}, _cancelSearch->lifetime()); });
rpl::combine( rpl::combine(
std::move(addMemberShown), std::move(addMemberShown),

View File

@ -310,6 +310,8 @@ void InnerWidget::mouseMoveEvent(QMouseEvent *e) {
} }
void InnerWidget::mouseReleaseEvent(QMouseEvent *e) { void InnerWidget::mouseReleaseEvent(QMouseEvent *e) {
setCursor(_selected ? style::cur_pointer : style::cur_default);
updateRow(_selected);
updateRow(_pressed); updateRow(_pressed);
auto pressed = std::exchange(_pressed, -1); auto pressed = std::exchange(_pressed, -1);
if (pressed >= 0 && pressed < _items.size()) { if (pressed >= 0 && pressed < _items.size()) {
@ -322,8 +324,6 @@ void InnerWidget::mouseReleaseEvent(QMouseEvent *e) {
Window::SectionShow::Way::Forward); Window::SectionShow::Way::Forward);
} }
} }
setCursor(_selected ? style::cur_pointer : style::cur_default);
updateRow(_selected);
} }
InnerWidget::Item *InnerWidget::computeItem(PeerData *group) { InnerWidget::Item *InnerWidget::computeItem(PeerData *group) {

View File

@ -118,9 +118,6 @@ void FadeAnimation::stopAnimation() {
} }
if (_visible == _widget->isHidden()) { if (_visible == _widget->isHidden()) {
_widget->setVisible(_visible); _widget->setVisible(_visible);
if (_visible) {
_widget->showChildren();
}
} }
} }

View File

@ -84,8 +84,6 @@ void SectionWidget::showFast() {
} }
void SectionWidget::paintEvent(QPaintEvent *e) { void SectionWidget::paintEvent(QPaintEvent *e) {
if (Ui::skipPaintEvent(this, e)) return;
if (_showAnimation) { if (_showAnimation) {
Painter p(this); Painter p(this);
_showAnimation->paintContents(p, e->rect()); _showAnimation->paintContents(p, e->rect());

View File

@ -396,6 +396,7 @@ void TopBarWidget::updateControlsVisibility() {
_call->hide(); _call->hide();
_info->hide(); _info->hide();
_menuToggle->hide(); _menuToggle->hide();
_infoToggle->hide();
_menu.destroy(); _menu.destroy();
} }
if (_membersShowArea) { if (_membersShowArea) {

View File

@ -72,7 +72,12 @@ void SlideAnimation::start() {
auto delta = st::slideShift; auto delta = st::slideShift;
auto fromLeft = (_direction == SlideDirection::FromLeft); auto fromLeft = (_direction == SlideDirection::FromLeft);
if (fromLeft) std::swap(_cacheUnder, _cacheOver); if (fromLeft) std::swap(_cacheUnder, _cacheOver);
_animation.start([this] { animationCallback(); }, fromLeft ? 1. : 0., fromLeft ? 0. : 1., st::slideDuration, transition()); _animation.start(
[this] { animationCallback(); },
fromLeft ? 1. : 0.,
fromLeft ? 0. : 1.,
st::slideDuration,
transition());
_repaintCallback(); _repaintCallback();
} }