Fixed space of action animation in middle text for different scales.

This commit is contained in:
23rd 2021-09-03 20:09:47 +03:00 committed by John Preston
parent dabe83bd27
commit 92425c7a1e

View file

@ -296,15 +296,17 @@ bool SendActionPainter::updateNeedsAnimating(crl::time now, bool force) {
const auto index = newTypingString.size()
- lang.rightIndexChoosingStickerReplacement(
isNamed);
animationLeft = _st.font->width(
newTypingString,
0,
index);
animationLeft = Ui::Text::String(
_st,
newTypingString.mid(0, index)).maxWidth();
if (!_spacesCount) {
_spacesCount = std::ceil(
// We have to use QFontMetricsF instead of
// FontData::spacew for more precise calculation.
const auto mf = QFontMetricsF(_st.font->f);
_spacesCount = std::round(
_sendActionAnimation.width()
/ _st.font->spacew);
/ mf.horizontalAdvance(' '));
}
newTypingString = newTypingString.replace(
index,