mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Fixed misaligned line in expanded reaction menu with disabled animation.
Fixed #26748.
This commit is contained in:
parent
787ed443f4
commit
90adc2d97c
2 changed files with 40 additions and 28 deletions
|
@ -424,7 +424,8 @@ void Selector::paintCollapsed(QPainter &p) {
|
|||
}
|
||||
|
||||
void Selector::paintExpanding(Painter &p, float64 progress) {
|
||||
const auto rects = paintExpandingBg(p, progress);
|
||||
const auto rects = updateExpandingRects(progress);
|
||||
paintExpandingBg(p, rects);
|
||||
progress /= kFullDuration;
|
||||
if (_footer) {
|
||||
_footer->paintExpanding(
|
||||
|
@ -443,8 +444,7 @@ void Selector::paintExpanding(Painter &p, float64 progress) {
|
|||
paintFadingExpandIcon(p, progress);
|
||||
}
|
||||
|
||||
auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
||||
-> ExpandingRects {
|
||||
Selector::ExpandingRects Selector::updateExpandingRects(float64 progress) {
|
||||
progress = (progress >= kExpandDuration)
|
||||
? 1.
|
||||
: (progress / kExpandDuration);
|
||||
|
@ -463,22 +463,6 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
|||
(height() - _outer.y() - _outer.height()),
|
||||
expanding);
|
||||
const auto outer = _outer.marginsAdded({ 0, expandUp, 0, expandDown });
|
||||
if (_useTransparency) {
|
||||
const auto pattern = _cachedRound.validateFrame(frame, 1., radius);
|
||||
const auto fill = _cachedRound.FillWithImage(p, outer, pattern);
|
||||
if (!fill.isEmpty()) {
|
||||
p.fillRect(fill, _st.bg);
|
||||
}
|
||||
} else {
|
||||
const auto inner = outer.marginsRemoved(marginsForShadow());
|
||||
p.fillRect(inner, _st.bg);
|
||||
p.fillRect(
|
||||
inner.x(),
|
||||
inner.y() + inner.height(),
|
||||
inner.width(),
|
||||
st::lineWidth,
|
||||
st::defaultPopupMenu.shadow.fallback);
|
||||
}
|
||||
const auto categories = anim::interpolate(
|
||||
0,
|
||||
extendTopForCategories(),
|
||||
|
@ -495,9 +479,26 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
|||
.radius = radius,
|
||||
.expanding = expanding,
|
||||
.finalBottom = height() - margins.bottom(),
|
||||
.frame = frame,
|
||||
.outer = outer,
|
||||
};
|
||||
}
|
||||
|
||||
void Selector::paintExpandingBg(QPainter &p, const ExpandingRects &rects) {
|
||||
if (_useTransparency) {
|
||||
const auto pattern = _cachedRound.validateFrame(
|
||||
rects.frame,
|
||||
1.,
|
||||
rects.radius);
|
||||
const auto fill = _cachedRound.FillWithImage(p, rects.outer, pattern);
|
||||
if (!fill.isEmpty()) {
|
||||
p.fillRect(fill, _st.bg);
|
||||
}
|
||||
} else {
|
||||
paintNonTransparentExpandRect(p, rects.outer - marginsForShadow());
|
||||
}
|
||||
}
|
||||
|
||||
void Selector::paintFadingExpandIcon(QPainter &p, float64 progress) {
|
||||
if (progress >= 1.) {
|
||||
return;
|
||||
|
@ -514,6 +515,18 @@ void Selector::paintFadingExpandIcon(QPainter &p, float64 progress) {
|
|||
p.setOpacity(1.);
|
||||
}
|
||||
|
||||
void Selector::paintNonTransparentExpandRect(
|
||||
QPainter &p,
|
||||
const QRect &inner) const {
|
||||
p.fillRect(inner, _st.bg);
|
||||
p.fillRect(
|
||||
inner.x(),
|
||||
inner.y() + inner.height(),
|
||||
inner.width(),
|
||||
st::lineWidth,
|
||||
st::defaultPopupMenu.shadow.fallback);
|
||||
}
|
||||
|
||||
void Selector::paintExpanded(QPainter &p) {
|
||||
if (!_expandFinished) {
|
||||
finishExpand();
|
||||
|
@ -521,14 +534,7 @@ void Selector::paintExpanded(QPainter &p) {
|
|||
if (_useTransparency) {
|
||||
p.drawImage(0, 0, _paintBuffer);
|
||||
} else {
|
||||
const auto inner = rect().marginsRemoved(marginsForShadow());
|
||||
p.fillRect(inner, _st.bg);
|
||||
p.fillRect(
|
||||
inner.x(),
|
||||
inner.y() + inner.height(),
|
||||
inner.width(),
|
||||
st::lineWidth,
|
||||
st::defaultPopupMenu.shadow.fallback);
|
||||
paintNonTransparentExpandRect(p, rect() - marginsForShadow());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,6 +542,7 @@ void Selector::finishExpand() {
|
|||
Expects(!_expandFinished);
|
||||
|
||||
_expandFinished = true;
|
||||
updateExpandingRects(kExpandDuration);
|
||||
if (_useTransparency) {
|
||||
auto q = QPainter(&_paintBuffer);
|
||||
q.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
|
|
|
@ -95,6 +95,8 @@ private:
|
|||
float64 radius = 0.;
|
||||
float64 expanding = 0.;
|
||||
int finalBottom = 0;
|
||||
int frame = 0;
|
||||
QRect outer;
|
||||
};
|
||||
|
||||
Selector(
|
||||
|
@ -117,12 +119,15 @@ private:
|
|||
void paintAppearing(QPainter &p);
|
||||
void paintCollapsed(QPainter &p);
|
||||
void paintExpanding(Painter &p, float64 progress);
|
||||
ExpandingRects paintExpandingBg(QPainter &p, float64 progress);
|
||||
void paintExpandingBg(QPainter &p, const ExpandingRects &rects);
|
||||
void paintFadingExpandIcon(QPainter &p, float64 progress);
|
||||
void paintExpanded(QPainter &p);
|
||||
void paintNonTransparentExpandRect(QPainter &p, const QRect &) const;
|
||||
void paintBubble(QPainter &p, int innerWidth);
|
||||
void paintBackgroundToBuffer();
|
||||
|
||||
ExpandingRects updateExpandingRects(float64 progress);
|
||||
|
||||
[[nodiscard]] int recentCount() const;
|
||||
[[nodiscard]] int countSkipLeft() const;
|
||||
[[nodiscard]] int lookupSelectedIndex(QPoint position) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue