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()); rect.setLeft(rect.x() + _textCache.maxWidth());
} }
if (jump1) { if (jump1) {
const auto x = (rect.width() > st::forumDialogJumpArrowSkip) const auto x = (rect.width() > 0)
? rect.x() ? rect.x()
: finalRight; : finalRight;
const auto add = st::forumDialogJumpArrowLeft; const auto add = st::forumDialogJumpArrowLeft;

View file

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

View file

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