mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 11:52:58 +00:00
Slightly improved style of top bar suggestions.
This commit is contained in:
@@ -894,7 +894,6 @@ dialogsTopBarSuggestionAboutStyle: TextStyle(defaultTextStyle) {
|
||||
font: font(11px);
|
||||
}
|
||||
dialogsTopBarSuggestionMargins: margins(8px, 8px, 8px, 8px);
|
||||
dialogsTopBarSuggestionRadius: 12px;
|
||||
dialogsTopBarSuggestionShadow: BoxShadow {
|
||||
blurRadius: 8px;
|
||||
offset: point(0px, 2px);
|
||||
|
||||
@@ -43,6 +43,14 @@ namespace {
|
||||
|
||||
constexpr auto kLinesForPhoto = 3;
|
||||
|
||||
[[nodiscard]] int PillRadius() {
|
||||
const auto padding = st::msgReplyPadding.top();
|
||||
return (padding
|
||||
+ st::semiboldTextStyle.font->height
|
||||
+ st::dialogsTopBarSuggestionAboutStyle.font->height
|
||||
+ padding) / 2;
|
||||
}
|
||||
|
||||
void PaintTopFade(QPainter &p, int outerWidth, int fadeHeight) {
|
||||
if (fadeHeight <= 0) {
|
||||
return;
|
||||
@@ -134,8 +142,15 @@ not_null<UnconfirmedAuthWrap*> CreateUnconfirmedAuthContent(
|
||||
content->paintOn([=](QPainter &p) {
|
||||
const auto outer = content->rect();
|
||||
const auto pill = outer - margins;
|
||||
const auto radius = st::dialogsTopBarSuggestionRadius;
|
||||
PaintTopFade(p, outer.width(), margins.top() + pill.height() / 2);
|
||||
if (pill.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
const auto radius = std::min({
|
||||
PillRadius(),
|
||||
pill.width() / 2,
|
||||
pill.height() / 2,
|
||||
});
|
||||
wrap->shadow().paint(p, pill, radius);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setBrush(st::dialogsBg);
|
||||
@@ -273,9 +288,15 @@ void TopBarSuggestionContent::setRightIcon(RightIcon icon) {
|
||||
const auto rightHide = _rightHide.get();
|
||||
sizeValue() | rpl::filter_size(
|
||||
) | rpl::on_next([=](const QSize &s) {
|
||||
const auto &button = st::dialogsCancelSearchInPeer;
|
||||
const auto padding = PillRadius()
|
||||
- button.rippleAreaSize / 2;
|
||||
const auto pillHeight = s.height() - rect::m::sum::v(margins);
|
||||
rightHide->moveToRight(
|
||||
margins.right() + st::buttonRadius,
|
||||
margins.top() + st::lineWidth);
|
||||
margins.right() + padding - button.rippleAreaPosition.x(),
|
||||
margins.top()
|
||||
+ (pillHeight - button.rippleAreaSize) / 2
|
||||
- button.rippleAreaPosition.y());
|
||||
}, rightHide->lifetime());
|
||||
rightHide->show();
|
||||
} else if (icon == RightIcon::Arrow) {
|
||||
@@ -340,10 +361,18 @@ void TopBarSuggestionContent::draw(QPainter &p) {
|
||||
const auto outer = Ui::RpWidget::rect();
|
||||
const auto &margins = st::dialogsTopBarSuggestionMargins;
|
||||
const auto pill = outer - margins;
|
||||
const auto radius = st::dialogsTopBarSuggestionRadius;
|
||||
|
||||
PaintTopFade(p, outer.width(), margins.top() + pill.height() / 2);
|
||||
|
||||
if (pill.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
const auto radius = std::min({
|
||||
PillRadius(),
|
||||
pill.width() / 2,
|
||||
pill.height() / 2,
|
||||
});
|
||||
|
||||
_shadow.paint(p, pill, radius);
|
||||
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
|
||||
Reference in New Issue
Block a user