mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed space of action animation in middle text for different scales.
This commit is contained in:
parent
dabe83bd27
commit
92425c7a1e
1 changed files with 8 additions and 6 deletions
|
@ -296,15 +296,17 @@ 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 = Ui::Text::String(
|
||||||
newTypingString,
|
_st,
|
||||||
0,
|
newTypingString.mid(0, index)).maxWidth();
|
||||||
index);
|
|
||||||
|
|
||||||
if (!_spacesCount) {
|
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()
|
_sendActionAnimation.width()
|
||||||
/ _st.font->spacew);
|
/ mf.horizontalAdvance(' '));
|
||||||
}
|
}
|
||||||
newTypingString = newTypingString.replace(
|
newTypingString = newTypingString.replace(
|
||||||
index,
|
index,
|
||||||
|
|
Loading…
Add table
Reference in a new issue