mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 15:17:07 +02:00
Fix small stories thumbnails in profile / my stories.
This commit is contained in:
parent
8a974273b9
commit
91cc5f5284
6 changed files with 29 additions and 20 deletions
Telegram/SourceFiles
|
@ -104,8 +104,6 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
|||
controller->setStoriesShown(true);
|
||||
const auto raw = controller.get();
|
||||
auto init = [=](not_null<PeerListBox*> box) {
|
||||
using namespace Dialogs::Stories;
|
||||
|
||||
struct State {
|
||||
QPointer<::Ui::IconButton> toggleSort;
|
||||
rpl::variable<Mode> mode = Mode::Online;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -389,11 +389,10 @@ void TopBar::updateStoriesGeometry(int newWidth) {
|
|||
}
|
||||
const auto left = (_back ? _st.back.width : _st.titlePosition.x())
|
||||
- st::dialogsStories.left - st::dialogsStories.photoLeft;
|
||||
const auto top = st::dialogsStories.height
|
||||
- st::dialogsStoriesFull.height
|
||||
+ (_st.height - st::dialogsStories.height) / 2;
|
||||
const auto top = (_st.height - st::dialogsStories.height) / 2;
|
||||
_stories->resizeToWidth(newWidth - left - right);
|
||||
_stories->moveToLeft(left, top, newWidth);
|
||||
_stories->entity()->setLayoutConstraints({ 0, 0 }, style::al_left);
|
||||
}
|
||||
|
||||
void TopBar::paintEvent(QPaintEvent *e) {
|
||||
|
|
|
@ -179,19 +179,17 @@ void InnerWidget::createButtons() {
|
|||
if (content.elements.empty()) {
|
||||
return;
|
||||
}
|
||||
const auto width = st::defaultDialogRow.padding.left()
|
||||
+ st::defaultDialogRow.photoSize
|
||||
+ st::defaultDialogRow.padding.left();
|
||||
const auto &small = st::dialogsStories;
|
||||
const auto count = int(content.elements.size());
|
||||
const auto smallWidth = small.photo + (count - 1) * small.shift;
|
||||
const auto real = smallWidth;
|
||||
const auto top = st::dialogsStories.height
|
||||
- st::dialogsStoriesFull.height
|
||||
+ (size.height() - st::dialogsStories.height) / 2;
|
||||
const auto right = st::settingsButtonRightSkip - (width - real) / 2;
|
||||
thumbs->resizeToWidth(width);
|
||||
thumbs->moveToRight(right, top);
|
||||
const auto height = small.photo + 2 * small.photoTop;
|
||||
const auto top = (size.height() - height) / 2;
|
||||
const auto right = st::settingsButtonRightSkip
|
||||
- small.left
|
||||
- small.photoLeft;
|
||||
const auto left = size.width() - right;
|
||||
thumbs->setLayoutConstraints({ left, top }, style::al_right);
|
||||
}, thumbs->lifetime());
|
||||
thumbs->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
recent->addClickHandler([=] {
|
||||
|
|
Loading…
Add table
Reference in a new issue