Improved horizontal animation for reply icon on left swipe.

This commit is contained in:
23rd 2024-09-03 14:18:17 +03:00 committed by John Preston
parent fb1b845211
commit 2aa5849997
2 changed files with 10 additions and 8 deletions

View file

@ -1495,11 +1495,17 @@ void Message::draw(Painter &p, const PaintContext &context) const {
constexpr auto kBouncePart = 0.25;
constexpr auto kStrokeWidth = 2.;
constexpr auto kWaveWidth = 10.;
const auto isLeftSize = (!context.outbg)
|| delegate()->elementIsChatWide();
const auto ratio = std::min(context.gestureHorizontal.ratio, 1.);
const auto reachRatio = context.gestureHorizontal.reachRatio;
const auto size = st::historyFastShareSize;
const auto outerWidth = st::historySwipeIconSkip
+ (isLeftSize ? rect::right(g) : width());
const auto rect = QRectF(
width() - (size * kShiftRatio) * context.gestureHorizontal.ratio,
outerWidth
- (size * kShiftRatio * context.gestureHorizontal.ratio)
- (st::historySwipeIconSkip * ratio * (isLeftSize ? .7 : 1.)),
g.y() + (g.height() - size) / 2,
size,
size);
@ -1533,13 +1539,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
p.translate(-center);
// All the next draws are mirrored.
p.drawEllipse(rect);
context.st->historyFastShareIcon().paintInCenter(
p,
QRect(
base::SafeRound(rect.x()),
base::SafeRound(rect.y()),
base::SafeRound(rect.width()),
base::SafeRound(rect.height())));
context.st->historyFastShareIcon().paintInCenter(p, rect);
p.setPen(pen);
p.setBrush(Qt::NoBrush);
p.drawArc(arcRect, arc::kQuarterLength, spanAngle);

View file

@ -570,6 +570,8 @@ historyFastTranscribeLockPos: point(18px, 13px);
historyFastTranscribeLockOverlayPos: point(21px, 13px);
historyFastTranscribeLockOverlaySize: size(6px, 10px);
historySwipeIconSkip: 80px;
historySavedFont: font(semibold 14px);
historyGroupWidthMax: maxMediaSize;