mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix large video being removed animation.
This commit is contained in:
parent
945411274f
commit
4f8989fad7
2 changed files with 24 additions and 9 deletions
|
@ -525,16 +525,30 @@ Viewport::Layout Viewport::countWide(int outerWidth, int outerHeight) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewport::showLarge(const VideoEndpoint &endpoint) {
|
void Viewport::showLarge(const VideoEndpoint &endpoint) {
|
||||||
const auto i = ranges::find(_tiles, endpoint, &VideoTile::endpoint);
|
// If a video get's switched off, GroupCall first unpins it,
|
||||||
const auto large = (i != end(_tiles)) ? i->get() : nullptr;
|
// then removes it from Large endpoint, then removes from active tracks.
|
||||||
if (_large != large) {
|
//
|
||||||
prepareLargeChangeAnimation();
|
// If we want to animate large video removal properly, we need to
|
||||||
_large = large;
|
// delay this update and start animation directly from removing of the
|
||||||
updateTopControlsVisibility();
|
// track from the active list. Otherwise final state won't be correct.
|
||||||
startLargeChangeAnimation();
|
_updateLargeScheduled = [=] {
|
||||||
}
|
const auto i = ranges::find(_tiles, endpoint, &VideoTile::endpoint);
|
||||||
|
const auto large = (i != end(_tiles)) ? i->get() : nullptr;
|
||||||
|
if (_large != large) {
|
||||||
|
prepareLargeChangeAnimation();
|
||||||
|
_large = large;
|
||||||
|
updateTopControlsVisibility();
|
||||||
|
startLargeChangeAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
Ensures(!_large || !_large->trackOrUserpicSize().isEmpty());
|
Ensures(!_large || !_large->trackOrUserpicSize().isEmpty());
|
||||||
|
};
|
||||||
|
crl::on_main(widget(), [=] {
|
||||||
|
if (!_updateLargeScheduled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
base::take(_updateLargeScheduled)();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewport::updateTilesGeometry() {
|
void Viewport::updateTilesGeometry() {
|
||||||
|
|
|
@ -176,6 +176,7 @@ private:
|
||||||
rpl::event_stream<VideoQualityRequest> _qualityRequests;
|
rpl::event_stream<VideoQualityRequest> _qualityRequests;
|
||||||
float64 _controlsShownRatio = 1.;
|
float64 _controlsShownRatio = 1.;
|
||||||
VideoTile *_large = nullptr;
|
VideoTile *_large = nullptr;
|
||||||
|
Fn<void()> _updateLargeScheduled;
|
||||||
Ui::Animations::Simple _largeChangeAnimation;
|
Ui::Animations::Simple _largeChangeAnimation;
|
||||||
Layout _startTilesLayout;
|
Layout _startTilesLayout;
|
||||||
Layout _finishTilesLayout;
|
Layout _finishTilesLayout;
|
||||||
|
|
Loading…
Add table
Reference in a new issue