mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 06:37:24 +02:00
Fix transcribe animation glitch in message view refresh.
This commit is contained in:
parent
6553e4492c
commit
1d64a03804
2 changed files with 14 additions and 7 deletions
|
@ -126,11 +126,15 @@ void TranscribeButton::setOpened(bool opened, Fn<void()> update) {
|
|||
return;
|
||||
}
|
||||
_opened = opened;
|
||||
_openedAnimation.start(
|
||||
std::move(update),
|
||||
_opened ? 0. : 1.,
|
||||
_opened ? 1. : 0.,
|
||||
st::fadeWrapDuration);
|
||||
if (update) {
|
||||
_openedAnimation.start(
|
||||
std::move(update),
|
||||
_opened ? 0. : 1.,
|
||||
_opened ? 1. : 0.,
|
||||
st::fadeWrapDuration);
|
||||
} else {
|
||||
_openedAnimation.stop();
|
||||
}
|
||||
}
|
||||
|
||||
ClickHandlerPtr TranscribeButton::link() {
|
||||
|
|
|
@ -243,7 +243,8 @@ QSize Document::countOptimalSize() {
|
|||
voice->transcribe = nullptr;
|
||||
voice->transcribeText = {};
|
||||
} else {
|
||||
if (!voice->transcribe) {
|
||||
const auto creating = !voice->transcribe;
|
||||
if (creating) {
|
||||
voice->transcribe = std::make_unique<TranscribeButton>(
|
||||
_realParent);
|
||||
}
|
||||
|
@ -262,7 +263,9 @@ QSize Document::countOptimalSize() {
|
|||
: TextWithEntities{
|
||||
entry.result + (entry.pending ? " [...]" : ""),
|
||||
};
|
||||
voice->transcribe->setOpened(!text.empty(), update);
|
||||
voice->transcribe->setOpened(
|
||||
!text.empty(),
|
||||
creating ? Fn<void()>() : update);
|
||||
if (text.empty()) {
|
||||
voice->transcribeText = {};
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue