Fix jump-to-topic area and unread counter overlapping.

This commit is contained in:
John Preston 2022-11-30 13:55:46 +04:00
parent f324017299
commit 823bbb1b77
3 changed files with 10 additions and 6 deletions

View File

@ -326,7 +326,7 @@ void MessageView::paint(
rect.setLeft(rect.x() + _textCache.maxWidth());
}
if (jump1) {
const auto x = (rect.width() > st::forumDialogJumpArrowSkip)
const auto x = (rect.width() > 0)
? rect.x()
: finalRight;
const auto add = st::forumDialogJumpArrowLeft;

View File

@ -119,6 +119,7 @@ void TopicsView::paint(
? st::dialogsTextPaletteArchiveOver
: st::dialogsTextPaletteArchive);
auto rect = geometry;
rect.setWidth(rect.width() - _lastTopicJumpGeometry.rightCut);
auto skipBig = _jumpToTopic && !context.active;
if (_titles.empty()) {
p.drawText(
@ -225,10 +226,12 @@ QImage TopicsView::topicJumpRippleMask(
}
JumpToLastGeometry FillJumpToLastBg(QPainter &p, JumpToLastBg context) {
const auto availableWidth = context.geometry.width();
const auto use1 = std::min(context.width1, availableWidth);
const auto use2 = std::min(context.width2, availableWidth);
const auto padding = st::forumDialogJumpPadding;
const auto availableWidth = context.geometry.width();
const auto want1 = std::min(context.width1, availableWidth);
const auto use1 = std::min(want1, availableWidth - padding.right());
const auto use2 = std::min(context.width2, availableWidth);
const auto rightCut = want1 - use1;
const auto origin = context.geometry.topLeft();
const auto delta = std::abs(use1 - use2);
if (delta <= context.st->topicsSkip / 2) {
@ -236,7 +239,7 @@ JumpToLastGeometry FillJumpToLastBg(QPainter &p, JumpToLastBg context) {
const auto h = context.st->topicsHeight + st::normalFont->height;
const auto fill = QRect(origin, QSize(w, h));
const auto full = fill.marginsAdded(padding);
auto result = JumpToLastGeometry{ full };
auto result = JumpToLastGeometry{ rightCut, full };
FillJumpToLastPrepared(p, {
.st = context.st,
.corners = context.corners,
@ -262,7 +265,7 @@ JumpToLastGeometry FillJumpToLastBg(QPainter &p, JumpToLastBg context) {
padding.right(),
padding.bottom(),
});
auto result = JumpToLastGeometry{ fill1, fill2 };
auto result = JumpToLastGeometry{ rightCut, fill1, fill2 };
FillJumpToLastPrepared(p, {
.st = context.st,
.corners = context.corners,

View File

@ -39,6 +39,7 @@ struct JumpToLastBg {
int width2 = 0;
};
struct JumpToLastGeometry {
int rightCut = 0;
QRect area1;
QRect area2;