Fixed misaligned line in expanded reaction menu with disabled animation.
Fixed #26748.
This commit is contained in:
parent
787ed443f4
commit
90adc2d97c
|
@ -424,7 +424,8 @@ void Selector::paintCollapsed(QPainter &p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Selector::paintExpanding(Painter &p, float64 progress) {
|
void Selector::paintExpanding(Painter &p, float64 progress) {
|
||||||
const auto rects = paintExpandingBg(p, progress);
|
const auto rects = updateExpandingRects(progress);
|
||||||
|
paintExpandingBg(p, rects);
|
||||||
progress /= kFullDuration;
|
progress /= kFullDuration;
|
||||||
if (_footer) {
|
if (_footer) {
|
||||||
_footer->paintExpanding(
|
_footer->paintExpanding(
|
||||||
|
@ -443,8 +444,7 @@ void Selector::paintExpanding(Painter &p, float64 progress) {
|
||||||
paintFadingExpandIcon(p, progress);
|
paintFadingExpandIcon(p, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
Selector::ExpandingRects Selector::updateExpandingRects(float64 progress) {
|
||||||
-> ExpandingRects {
|
|
||||||
progress = (progress >= kExpandDuration)
|
progress = (progress >= kExpandDuration)
|
||||||
? 1.
|
? 1.
|
||||||
: (progress / kExpandDuration);
|
: (progress / kExpandDuration);
|
||||||
|
@ -463,22 +463,6 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
||||||
(height() - _outer.y() - _outer.height()),
|
(height() - _outer.y() - _outer.height()),
|
||||||
expanding);
|
expanding);
|
||||||
const auto outer = _outer.marginsAdded({ 0, expandUp, 0, expandDown });
|
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(
|
const auto categories = anim::interpolate(
|
||||||
0,
|
0,
|
||||||
extendTopForCategories(),
|
extendTopForCategories(),
|
||||||
|
@ -495,9 +479,26 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
||||||
.radius = radius,
|
.radius = radius,
|
||||||
.expanding = expanding,
|
.expanding = expanding,
|
||||||
.finalBottom = height() - margins.bottom(),
|
.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) {
|
void Selector::paintFadingExpandIcon(QPainter &p, float64 progress) {
|
||||||
if (progress >= 1.) {
|
if (progress >= 1.) {
|
||||||
return;
|
return;
|
||||||
|
@ -514,6 +515,18 @@ void Selector::paintFadingExpandIcon(QPainter &p, float64 progress) {
|
||||||
p.setOpacity(1.);
|
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) {
|
void Selector::paintExpanded(QPainter &p) {
|
||||||
if (!_expandFinished) {
|
if (!_expandFinished) {
|
||||||
finishExpand();
|
finishExpand();
|
||||||
|
@ -521,14 +534,7 @@ void Selector::paintExpanded(QPainter &p) {
|
||||||
if (_useTransparency) {
|
if (_useTransparency) {
|
||||||
p.drawImage(0, 0, _paintBuffer);
|
p.drawImage(0, 0, _paintBuffer);
|
||||||
} else {
|
} else {
|
||||||
const auto inner = rect().marginsRemoved(marginsForShadow());
|
paintNonTransparentExpandRect(p, rect() - marginsForShadow());
|
||||||
p.fillRect(inner, _st.bg);
|
|
||||||
p.fillRect(
|
|
||||||
inner.x(),
|
|
||||||
inner.y() + inner.height(),
|
|
||||||
inner.width(),
|
|
||||||
st::lineWidth,
|
|
||||||
st::defaultPopupMenu.shadow.fallback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,6 +542,7 @@ void Selector::finishExpand() {
|
||||||
Expects(!_expandFinished);
|
Expects(!_expandFinished);
|
||||||
|
|
||||||
_expandFinished = true;
|
_expandFinished = true;
|
||||||
|
updateExpandingRects(kExpandDuration);
|
||||||
if (_useTransparency) {
|
if (_useTransparency) {
|
||||||
auto q = QPainter(&_paintBuffer);
|
auto q = QPainter(&_paintBuffer);
|
||||||
q.setCompositionMode(QPainter::CompositionMode_Source);
|
q.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
|
|
|
@ -95,6 +95,8 @@ private:
|
||||||
float64 radius = 0.;
|
float64 radius = 0.;
|
||||||
float64 expanding = 0.;
|
float64 expanding = 0.;
|
||||||
int finalBottom = 0;
|
int finalBottom = 0;
|
||||||
|
int frame = 0;
|
||||||
|
QRect outer;
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector(
|
Selector(
|
||||||
|
@ -117,12 +119,15 @@ private:
|
||||||
void paintAppearing(QPainter &p);
|
void paintAppearing(QPainter &p);
|
||||||
void paintCollapsed(QPainter &p);
|
void paintCollapsed(QPainter &p);
|
||||||
void paintExpanding(Painter &p, float64 progress);
|
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 paintFadingExpandIcon(QPainter &p, float64 progress);
|
||||||
void paintExpanded(QPainter &p);
|
void paintExpanded(QPainter &p);
|
||||||
|
void paintNonTransparentExpandRect(QPainter &p, const QRect &) const;
|
||||||
void paintBubble(QPainter &p, int innerWidth);
|
void paintBubble(QPainter &p, int innerWidth);
|
||||||
void paintBackgroundToBuffer();
|
void paintBackgroundToBuffer();
|
||||||
|
|
||||||
|
ExpandingRects updateExpandingRects(float64 progress);
|
||||||
|
|
||||||
[[nodiscard]] int recentCount() const;
|
[[nodiscard]] int recentCount() const;
|
||||||
[[nodiscard]] int countSkipLeft() const;
|
[[nodiscard]] int countSkipLeft() const;
|
||||||
[[nodiscard]] int lookupSelectedIndex(QPoint position) const;
|
[[nodiscard]] int lookupSelectedIndex(QPoint position) const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user