Fix animation lag in shared media.

This commit is contained in:
John Preston 2017-11-06 12:09:58 +04:00
parent 47a52b0587
commit a7807420fa
2 changed files with 5 additions and 5 deletions

View File

@ -319,7 +319,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
rpl::combine(
tracker.atLeastOneShownValue(),
_controller->wrapValue(),
_isStackBottom.events())
_isStackBottom.value())
| rpl::combine_previous(ToggledData())
| rpl::start_with_next([wrap = result.data()](
const ToggledData &was,
@ -333,7 +333,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
//auto [nowOneShown, nowWrap, nowStackBottom] = now;
wrap->toggle(
nowOneShown && (nowWrap != Wrap::Side || !nowStackBottom),
(wasOneShown == nowOneShown && wasWrap == nowWrap)
(wasStackBottom == nowStackBottom && wasWrap == nowWrap)
? anim::type::normal
: anim::type::instant);
}, result->lifetime());

View File

@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <rpl/producer.h>
#include <rpl/variable.h>
#include "ui/rp_widget.h"
namespace Window {
@ -55,7 +55,7 @@ public:
void restoreState(not_null<Memento*> memento);
void setIsStackBottom(bool isStackBottom) {
_isStackBottom.fire_copy(isStackBottom);
_isStackBottom = isStackBottom;
}
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const {
return _scrollToRequests.events();
@ -94,7 +94,7 @@ private:
bool canHideDetailsEver() const;
rpl::producer<bool> canHideDetails() const;
rpl::event_stream<bool> _isStackBottom;
rpl::variable<bool> _isStackBottom = true;
const not_null<Controller*> _controller;
const not_null<PeerData*> _peer;