Fixed position of send action animation.

This commit is contained in:
23rd 2021-08-31 13:59:33 +03:00 committed by John Preston
parent 0f28069881
commit 92b7afc5f5

View file

@ -221,6 +221,7 @@ bool SendActionPainter::updateNeedsAnimating(crl::time now, bool force) {
const auto wasSpeakingAnimation = !!_speakingAnimation; const auto wasSpeakingAnimation = !!_speakingAnimation;
if (force || sendActionChanged || speakingChanged) { if (force || sendActionChanged || speakingChanged) {
QString newTypingString; QString newTypingString;
auto animationLeft = 0;
auto typingCount = _typing.size(); auto typingCount = _typing.size();
if (typingCount > 2) { if (typingCount > 2) {
newTypingString = tr::lng_many_typing(tr::now, lt_count, typingCount); newTypingString = tr::lng_many_typing(tr::now, lt_count, typingCount);
@ -295,7 +296,7 @@ bool SendActionPainter::updateNeedsAnimating(crl::time now, bool force) {
const auto index = newTypingString.size() const auto index = newTypingString.size()
- lang.rightIndexChoosingStickerReplacement( - lang.rightIndexChoosingStickerReplacement(
isNamed); isNamed);
_animationLeft = _st.font->width( animationLeft = _st.font->width(
newTypingString, newTypingString,
0, 0,
index); index);
@ -310,8 +311,6 @@ bool SendActionPainter::updateNeedsAnimating(crl::time now, bool force) {
Lang::kChoosingStickerReplacement.utf8().size(), Lang::kChoosingStickerReplacement.utf8().size(),
QString().fill(' ', _spacesCount).constData(), QString().fill(' ', _spacesCount).constData(),
_spacesCount); _spacesCount);
} else {
_animationLeft = 0;
} }
break; break;
@ -356,6 +355,9 @@ bool SendActionPainter::updateNeedsAnimating(crl::time now, bool force) {
_sendActionString, _sendActionString,
Ui::NameTextOptions()); Ui::NameTextOptions());
} }
if (_animationLeft != animationLeft) {
_animationLeft = animationLeft;
}
if (_speaking.empty()) { if (_speaking.empty()) {
_speakingAnimation.tryToFinish(); _speakingAnimation.tryToFinish();
} else { } else {