mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix window extents terminology
Extents is a synonym of size but we're setting not window size.
This commit is contained in:
parent
77c2e12ebc
commit
d0eb7ec522
4 changed files with 39 additions and 39 deletions
|
@ -241,7 +241,7 @@ int Selector::countWidth(int desiredWidth, int maxWidth) {
|
|||
return std::max(2 * _skipx + _columns * _size, desiredWidth);
|
||||
}
|
||||
|
||||
QMargins Selector::extentsForShadow() const {
|
||||
QMargins Selector::marginsForShadow() const {
|
||||
const auto line = st::lineWidth;
|
||||
return useTransparency()
|
||||
? st::reactionCornerShadow
|
||||
|
@ -264,26 +264,26 @@ void Selector::setSpecialExpandTopSkip(int skip) {
|
|||
}
|
||||
|
||||
void Selector::initGeometry(int innerTop) {
|
||||
const auto extents = extentsForShadow();
|
||||
const auto margins = marginsForShadow();
|
||||
const auto parent = parentWidget()->rect();
|
||||
const auto innerWidth = 2 * _skipx + _columns * _size;
|
||||
const auto innerHeight = st::reactStripHeight;
|
||||
const auto width = _useTransparency
|
||||
? (innerWidth + extents.left() + extents.right())
|
||||
? (innerWidth + margins.left() + margins.right())
|
||||
: parent.width();
|
||||
const auto height = innerHeight + extents.top() + extents.bottom();
|
||||
const auto height = innerHeight + margins.top() + margins.bottom();
|
||||
const auto left = style::RightToLeft() ? 0 : (parent.width() - width);
|
||||
_collapsedTopSkip = _useTransparency
|
||||
? (extendTopForCategories() + _specialExpandTopSkip)
|
||||
: 0;
|
||||
const auto top = innerTop - extents.top() - _collapsedTopSkip;
|
||||
const auto add = _st.icons.stripBubble.height() - extents.bottom();
|
||||
const auto top = innerTop - margins.top() - _collapsedTopSkip;
|
||||
const auto add = _st.icons.stripBubble.height() - margins.bottom();
|
||||
_outer = QRect(0, _collapsedTopSkip, width, height);
|
||||
_outerWithBubble = _outer.marginsAdded({ 0, 0, 0, add });
|
||||
setGeometry(_outerWithBubble.marginsAdded(
|
||||
{ 0, _collapsedTopSkip, 0, 0 }
|
||||
).translated(left, top));
|
||||
_inner = _outer.marginsRemoved(extents);
|
||||
_inner = _outer.marginsRemoved(margins);
|
||||
|
||||
if (!_strip) {
|
||||
expand();
|
||||
|
@ -343,9 +343,9 @@ void Selector::paintAppearing(QPainter &p) {
|
|||
}
|
||||
_paintBuffer.fill(_st.bg->c);
|
||||
auto q = QPainter(&_paintBuffer);
|
||||
const auto extents = extentsForShadow();
|
||||
const auto margins = marginsForShadow();
|
||||
const auto appearedWidth = countAppearedWidth(_appearProgress);
|
||||
const auto fullWidth = _inner.x() + appearedWidth + extents.right();
|
||||
const auto fullWidth = _inner.x() + appearedWidth + margins.right();
|
||||
const auto size = QSize(fullWidth, _outer.height());
|
||||
|
||||
q.translate(_inner.topLeft() - QPoint(0, _collapsedTopSkip));
|
||||
|
@ -455,7 +455,7 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
|||
const auto radius = _reactions.customAllowed
|
||||
? (radiusStart + progress * (radiusEnd - radiusStart))
|
||||
: radiusStart;
|
||||
const auto extents = extentsForShadow();
|
||||
const auto margins = marginsForShadow();
|
||||
const auto expanding = anim::easeOutCirc(1., progress);
|
||||
const auto expandUp = anim::interpolate(0, _collapsedTopSkip, expanding);
|
||||
const auto expandDown = anim::interpolate(
|
||||
|
@ -470,7 +470,7 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
|||
p.fillRect(fill, _st.bg);
|
||||
}
|
||||
} else {
|
||||
const auto inner = outer.marginsRemoved(extentsForShadow());
|
||||
const auto inner = outer.marginsRemoved(marginsForShadow());
|
||||
p.fillRect(inner, _st.bg);
|
||||
p.fillRect(
|
||||
inner.x(),
|
||||
|
@ -483,7 +483,7 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
|||
0,
|
||||
extendTopForCategories(),
|
||||
expanding);
|
||||
const auto inner = outer.marginsRemoved(extents);
|
||||
const auto inner = outer.marginsRemoved(margins);
|
||||
_shadowTop = inner.y() + categories;
|
||||
_shadowSkip = (_useTransparency && categories < radius)
|
||||
? int(base::SafeRound(
|
||||
|
@ -494,7 +494,7 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
|||
.list = inner.marginsRemoved({ 0, categories, 0, 0 }),
|
||||
.radius = radius,
|
||||
.expanding = expanding,
|
||||
.finalBottom = height() - extents.bottom(),
|
||||
.finalBottom = height() - margins.bottom(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ void Selector::paintExpanded(QPainter &p) {
|
|||
if (_useTransparency) {
|
||||
p.drawImage(0, 0, _paintBuffer);
|
||||
} else {
|
||||
const auto inner = rect().marginsRemoved(extentsForShadow());
|
||||
const auto inner = rect().marginsRemoved(marginsForShadow());
|
||||
p.fillRect(inner, _st.bg);
|
||||
p.fillRect(
|
||||
inner.x(),
|
||||
|
@ -694,13 +694,13 @@ void Selector::expand() {
|
|||
_willExpand.fire({});
|
||||
preloadAllRecentsAnimations();
|
||||
const auto parent = parentWidget()->geometry();
|
||||
const auto extents = extentsForShadow();
|
||||
const auto margins = marginsForShadow();
|
||||
const auto heightLimit = _reactions.customAllowed
|
||||
? st::emojiPanMaxHeight
|
||||
: minimalHeight();
|
||||
const auto willBeHeight = std::min(
|
||||
parent.height() - y(),
|
||||
extents.top() + heightLimit + extents.bottom());
|
||||
margins.top() + heightLimit + margins.bottom());
|
||||
const auto additionalBottom = willBeHeight - height();
|
||||
const auto additional = _specialExpandTopSkip + additionalBottom;
|
||||
if (additionalBottom < 0 || additional <= 0) {
|
||||
|
@ -834,7 +834,7 @@ void Selector::createList() {
|
|||
_list->jumpedToPremium(
|
||||
) | rpl::start_with_next(_jumpedToPremium, _list->lifetime());
|
||||
|
||||
const auto inner = rect().marginsRemoved(extentsForShadow());
|
||||
const auto inner = rect().marginsRemoved(marginsForShadow());
|
||||
const auto footer = _reactions.customAllowed
|
||||
? _list->createFooter().data()
|
||||
: nullptr;
|
||||
|
@ -904,16 +904,16 @@ bool AdjustMenuGeometryForSelector(
|
|||
const auto desiredWidth = menu->menu()->width() + added;
|
||||
const auto maxWidth = menu->st().menu.widthMax + added;
|
||||
const auto width = selector->countWidth(desiredWidth, maxWidth);
|
||||
const auto extents = selector->extentsForShadow();
|
||||
const auto margins = selector->marginsForShadow();
|
||||
const auto categoriesTop = selector->useTransparency()
|
||||
? selector->extendTopForCategories()
|
||||
: 0;
|
||||
menu->setForceWidth(width - added);
|
||||
const auto height = menu->height();
|
||||
const auto fullTop = extents.top() + categoriesTop + extend.top();
|
||||
const auto minimalHeight = extents.top()
|
||||
const auto fullTop = margins.top() + categoriesTop + extend.top();
|
||||
const auto minimalHeight = margins.top()
|
||||
+ selector->minimalHeight()
|
||||
+ extents.bottom();
|
||||
+ margins.bottom();
|
||||
const auto willBeHeightWithoutBottomPadding = fullTop
|
||||
+ height
|
||||
- menu->st().shadow.extend.top();
|
||||
|
@ -924,15 +924,15 @@ bool AdjustMenuGeometryForSelector(
|
|||
? (minimalHeight - willBeHeightWithoutBottomPadding)
|
||||
: 0);
|
||||
menu->setAdditionalMenuPadding(QMargins(
|
||||
extents.left() + extend.left(),
|
||||
margins.left() + extend.left(),
|
||||
fullTop,
|
||||
extents.right() + extend.right(),
|
||||
margins.right() + extend.right(),
|
||||
additionalPaddingBottom
|
||||
), QMargins(
|
||||
extents.left(),
|
||||
extents.top(),
|
||||
extents.right(),
|
||||
std::min(additionalPaddingBottom, extents.bottom())
|
||||
margins.left(),
|
||||
margins.top(),
|
||||
margins.right(),
|
||||
std::min(additionalPaddingBottom, margins.bottom())
|
||||
));
|
||||
if (!menu->prepareGeometryFor(desiredPosition)) {
|
||||
return false;
|
||||
|
@ -944,14 +944,14 @@ bool AdjustMenuGeometryForSelector(
|
|||
return true;
|
||||
}
|
||||
menu->setAdditionalMenuPadding(QMargins(
|
||||
extents.left() + extend.left(),
|
||||
margins.left() + extend.left(),
|
||||
fullTop + additionalPaddingBottom,
|
||||
extents.right() + extend.right(),
|
||||
margins.right() + extend.right(),
|
||||
0
|
||||
), QMargins(
|
||||
extents.left(),
|
||||
extents.top(),
|
||||
extents.right(),
|
||||
margins.left(),
|
||||
margins.top(),
|
||||
margins.right(),
|
||||
0
|
||||
));
|
||||
selector->setSpecialExpandTopSkip(additionalPaddingBottom);
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
[[nodiscard]] bool useTransparency() const;
|
||||
|
||||
int countWidth(int desiredWidth, int maxWidth);
|
||||
[[nodiscard]] QMargins extentsForShadow() const;
|
||||
[[nodiscard]] QMargins marginsForShadow() const;
|
||||
[[nodiscard]] int extendTopForCategories() const;
|
||||
[[nodiscard]] int minimalHeight() const;
|
||||
[[nodiscard]] int countAppearedWidth(float64 progress) const;
|
||||
|
|
|
@ -243,18 +243,18 @@ void Reactions::Panel::create() {
|
|||
const auto desiredWidth = st::storiesReactionsWidth;
|
||||
const auto maxWidth = desiredWidth * 2;
|
||||
const auto width = _selector->countWidth(desiredWidth, maxWidth);
|
||||
const auto extents = _selector->extentsForShadow();
|
||||
const auto margins = _selector->marginsForShadow();
|
||||
const auto categoriesTop = _selector->extendTopForCategories();
|
||||
const auto full = extents.left() + width + extents.right();
|
||||
const auto full = margins.left() + width + margins.right();
|
||||
|
||||
_shownValue = 0.;
|
||||
rpl::combine(
|
||||
_controller->layoutValue(),
|
||||
_shownValue.value()
|
||||
) | rpl::start_with_next([=](const Layout &layout, float64 shown) {
|
||||
const auto width = extents.left()
|
||||
const auto width = margins.left()
|
||||
+ _selector->countAppearedWidth(shown)
|
||||
+ extents.right();
|
||||
+ margins.right();
|
||||
const auto height = layout.reactions.height();
|
||||
const auto shift = (width / 2);
|
||||
const auto right = (mode == Mode::Message)
|
||||
|
@ -271,7 +271,7 @@ void Reactions::Panel::create() {
|
|||
const auto innerTop = height
|
||||
- st::storiesReactionsBottomSkip
|
||||
- st::reactStripHeight;
|
||||
const auto maxAdded = innerTop - extents.top() - categoriesTop;
|
||||
const auto maxAdded = innerTop - margins.top() - categoriesTop;
|
||||
const auto added = std::min(maxAdded, st::storiesReactionsAddedTop);
|
||||
_selector->setSpecialExpandTopSkip(added);
|
||||
_selector->initGeometry(innerTop);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 552db4b24f4542dcb6d19302d7e29ff00349b156
|
||||
Subproject commit bcf88b90658c7e0925c11c486732d874477baf0d
|
Loading…
Add table
Reference in a new issue