Position ttl button correctly on record finish.

This commit is contained in:
John Preston 2024-10-30 10:34:53 +04:00
parent 2d6d89b1cf
commit 472a2fe802
2 changed files with 12 additions and 1 deletions

View file

@ -1431,7 +1431,12 @@ void VoiceRecordBar::updateTTLGeometry(
const auto parent = parentWidget();
const auto me = Ui::MapFrom(_outerContainer, parent, geometry());
const auto anyTop = me.y() - st::historyRecordLockPosition.y();
const auto ttlFrom = anyTop - _ttlButton->height() * 2;
const auto lockHiddenProgress = (_lockShowing.current() || !_fullRecord)
? 0.
: (1. - _showLockAnimation.value(0.));
const auto ttlFrom = anyTop
- _ttlButton->height()
- (_ttlButton->height() * (1. - lockHiddenProgress));
if (type == TTLAnimationType::RightLeft) {
const auto finalRight = _outerContainer->width()
- rect::right(me)
@ -1551,6 +1556,9 @@ void VoiceRecordBar::init() {
} else if (value == 1. && show) {
computeAndSetLockProgress(QCursor::pos());
}
if (_fullRecord && !show) {
updateTTLGeometry(TTLAnimationType::RightLeft, 1.);
}
};
_showLockAnimation.start(std::move(callback), from, to, duration);
}, lifetime());
@ -1664,6 +1672,7 @@ void VoiceRecordBar::init() {
}
_recordingTipRequire = crl::now();
_recordingVideo = (_send->type() == Ui::SendButton::Type::Round);
_fullRecord = false;
_ttlButton = nullptr;
_lock->setRecordingVideo(_recordingVideo);
_startTimer.callOnce(st::universalDuration);
@ -1828,6 +1837,7 @@ void VoiceRecordBar::startRecording() {
) | rpl::start_with_next_error([=](const Update &update) {
recordUpdated(update.level, update.samples);
if (update.finished) {
_fullRecord = true;
stopRecording(StopType::Listen);
_lockShowing = false;
}

View file

@ -208,6 +208,7 @@ private:
std::vector<std::unique_ptr<Ui::RoundVideoRecorder>> _videoHiding;
rpl::lifetime _videoCapturerLifetime;
bool _recordingVideo = false;
bool _fullRecord = false;
const style::font &_cancelFont;