Improve expanded state of small amount of stories.

This commit is contained in:
John Preston 2023-07-14 12:22:50 +04:00
parent 10f65c63e7
commit 94820f36ba
1 changed files with 13 additions and 11 deletions

View File

@ -206,12 +206,18 @@ List::Layout List::computeLayout(float64 expanded) const {
const auto lerp = [&](float64 a, float64 b) {
return a + (b - a) * ratio;
};
const auto singleFull = full.photoLeft * 2 + full.photo;
const auto widthFull = width();
const auto itemsCount = int(_data.items.size());
const auto narrowWidth = st::defaultDialogRow.padding.left()
+ st::defaultDialogRow.photoSize
+ st::defaultDialogRow.padding.left();
const auto narrow = false;// (width() <= narrowWidth);
const auto leftFullMin = full.left;
const auto singleFullMin = full.photoLeft * 2 + full.photo;
const auto totalFull = leftFullMin + singleFullMin * itemsCount;
const auto skipSide = (totalFull < widthFull)
? (widthFull - totalFull) / (itemsCount + 1)
: 0;
const auto skipBetween = (totalFull < widthFull && itemsCount > 1)
? (widthFull - totalFull - 2 * skipSide) / (itemsCount - 1)
: skipSide;
const auto singleFull = singleFullMin + skipBetween;
const auto smallSkip = (itemsCount > 1
&& _data.items[0].element.skipSmall)
? 1
@ -220,12 +226,8 @@ List::Layout List::computeLayout(float64 expanded) const {
kSmallThumbsShown,
itemsCount - smallSkip);
const auto smallWidth = st.photo + (smallCount - 1) * st.shift;
const auto leftSmall = (narrow
? ((narrowWidth - smallWidth) / 2 - st.photoLeft)
: st.left) - (smallSkip ? st.shift : 0);
const auto leftFull = (narrow
? ((narrowWidth - full.photo) / 2 - full.photoLeft)
: full.left) - _scrollLeft;
const auto leftSmall = st.left - (smallSkip ? st.shift : 0);
const auto leftFull = full.left - _scrollLeft + skipSide;
const auto startIndexFull = std::max(-leftFull, 0) / singleFull;
const auto cellLeftFull = leftFull + (startIndexFull * singleFull);
const auto endIndexFull = std::min(