2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix small stories thumbnails in profile / my stories.

This commit is contained in:
John Preston
2023-07-13 11:15:37 +04:00
parent 8a974273b9
commit 91cc5f5284
6 changed files with 29 additions and 20 deletions

View File

@@ -2697,6 +2697,7 @@ void Widget::updateControlsGeometry() {
if (_stories) {
_stories->setLayoutConstraints(
{ filterLeft + filterWidth, filterTop + added },
style::al_right,
{ 0, expandedStoriesTop, barw, st::dialogsStoriesFull.height });
}
if (_forumTopShadow) {

View File

@@ -661,8 +661,12 @@ bool List::checkForFullState() {
return true;
}
void List::setLayoutConstraints(QPoint topRightSmall, QRect geometryFull) {
_topRightSmall = topRightSmall;
void List::setLayoutConstraints(
QPoint positionSmall,
style::align alignSmall,
QRect geometryFull) {
_positionSmall = positionSmall;
_alignSmall = alignSmall;
_geometryFull = geometryFull;
updateGeometry();
update();
@@ -690,9 +694,14 @@ QRect List::countSmallGeometry() const {
+ st.photo + (count - 1) * st.shift
+ st.photoLeft
+ st.left;
const auto left = ((_alignSmall & Qt::AlignRight) == Qt::AlignRight)
? (_positionSmall.x() - width)
: ((_alignSmall & Qt::AlignCenter) == Qt::AlignCenter)
? (_positionSmall.x() - (width / 2))
: _positionSmall.x();
return QRect(
_topRightSmall.x() - width,
_topRightSmall.y(),
left,
_positionSmall.y(),
width,
st.photoTop + st.photo + st.photoTop);
}

View File

@@ -66,7 +66,10 @@ public:
rpl::producer<Content> content);
void setExpandedHeight(int height, bool momentum = false);
void setLayoutConstraints(QPoint topRightSmall, QRect geometryFull);
void setLayoutConstraints(
QPoint positionSmall,
style::align alignSmall,
QRect geometryFull = QRect());
[[nodiscard]] bool empty() const {
return _empty.current();
@@ -137,7 +140,8 @@ private:
rpl::event_stream<> _entered;
rpl::event_stream<> _loadMoreRequests;
QPoint _topRightSmall;
QPoint _positionSmall;
style::align _alignSmall = {};
QRect _geometryFull;
QRect _changingGeometryFrom;
State _state = State::Small;