mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
return;
|
||||||
}
|
}
|
||||||
_opened = opened;
|
_opened = opened;
|
||||||
_openedAnimation.start(
|
if (update) {
|
||||||
std::move(update),
|
_openedAnimation.start(
|
||||||
_opened ? 0. : 1.,
|
std::move(update),
|
||||||
_opened ? 1. : 0.,
|
_opened ? 0. : 1.,
|
||||||
st::fadeWrapDuration);
|
_opened ? 1. : 0.,
|
||||||
|
st::fadeWrapDuration);
|
||||||
|
} else {
|
||||||
|
_openedAnimation.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClickHandlerPtr TranscribeButton::link() {
|
ClickHandlerPtr TranscribeButton::link() {
|
||||||
|
|
|
@ -243,7 +243,8 @@ QSize Document::countOptimalSize() {
|
||||||
voice->transcribe = nullptr;
|
voice->transcribe = nullptr;
|
||||||
voice->transcribeText = {};
|
voice->transcribeText = {};
|
||||||
} else {
|
} else {
|
||||||
if (!voice->transcribe) {
|
const auto creating = !voice->transcribe;
|
||||||
|
if (creating) {
|
||||||
voice->transcribe = std::make_unique<TranscribeButton>(
|
voice->transcribe = std::make_unique<TranscribeButton>(
|
||||||
_realParent);
|
_realParent);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +263,9 @@ QSize Document::countOptimalSize() {
|
||||||
: TextWithEntities{
|
: TextWithEntities{
|
||||||
entry.result + (entry.pending ? " [...]" : ""),
|
entry.result + (entry.pending ? " [...]" : ""),
|
||||||
};
|
};
|
||||||
voice->transcribe->setOpened(!text.empty(), update);
|
voice->transcribe->setOpened(
|
||||||
|
!text.empty(),
|
||||||
|
creating ? Fn<void()>() : update);
|
||||||
if (text.empty()) {
|
if (text.empty()) {
|
||||||
voice->transcribeText = {};
|
voice->transcribeText = {};
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue