From fb2924f2d6a1697e2d69f36e97fe1de44ae48de9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 11 Nov 2020 23:13:57 +0300 Subject: [PATCH] Fixed size and position of lock/stop button at end of animation. --- .../controls/history_view_voice_record_bar.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index bdd887c413..ff7531982e 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -623,16 +623,15 @@ RecordLock::RecordLock(not_null parent) Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin) { - resize( - st::historyRecordLockTopShadow.width(), - st::historyRecordLockSize.height()); - // resize(st::historyRecordLockSize); init(); } void RecordLock::init() { shownValue( ) | rpl::start_with_next([=](bool shown) { + resize( + st::historyRecordLockTopShadow.width(), + st::historyRecordLockSize.height()); if (!shown) { setCursor(style::cur_default); setAttribute(Qt::WA_TransparentForMouseEvents, true); @@ -667,6 +666,10 @@ void RecordLock::init() { if (value == to) { setCursor(style::cur_pointer); setAttribute(Qt::WA_TransparentForMouseEvents, false); + + resize( + st::historyRecordLockTopShadow.width(), + st::historyRecordLockTopShadow.width()); } }; _lockAnimation.start(std::move(callback), from, to, duration); @@ -1115,9 +1118,10 @@ void VoiceRecordBar::setStartRecordingFilter(Fn &&callback) { } void VoiceRecordBar::setLockBottom(rpl::producer &&bottom) { - std::move( - bottom - ) | rpl::start_with_next([=](int value) { + rpl::combine( + std::move(bottom), + _lock->sizeValue() | rpl::map_to(true) // Dummy value. + ) | rpl::start_with_next([=](int value, bool dummy) { _lock->moveToLeft(_lock->x(), value - _lock->height()); }, lifetime()); }