mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-08 20:53:54 +00:00
[thanos] Tracked original gap height to fix post-deletion gap positions.
This commit is contained in:
@@ -7588,6 +7588,7 @@ void HistoryWidget::startCollapseAnimation(int height, int itemTop) {
|
||||
&& itemTop <= gap.absY + gap.currentHeight)) {
|
||||
gap.startHeight += height;
|
||||
gap.currentHeight += height;
|
||||
gap.originalHeight += height;
|
||||
merged = true;
|
||||
break;
|
||||
}
|
||||
@@ -7595,6 +7596,7 @@ void HistoryWidget::startCollapseAnimation(int height, int itemTop) {
|
||||
gap.absY = itemTop;
|
||||
gap.startHeight += height;
|
||||
gap.currentHeight += height;
|
||||
gap.originalHeight += height;
|
||||
merged = true;
|
||||
break;
|
||||
}
|
||||
@@ -7604,6 +7606,7 @@ void HistoryWidget::startCollapseAnimation(int height, int itemTop) {
|
||||
.absY = itemTop,
|
||||
.startHeight = height,
|
||||
.currentHeight = height,
|
||||
.originalHeight = height,
|
||||
});
|
||||
std::sort(_collapseGaps.begin(), _collapseGaps.end(),
|
||||
[](const auto &a, const auto &b) { return a.absY < b.absY; });
|
||||
@@ -7660,8 +7663,13 @@ void HistoryWidget::syncCollapseGapsToList() {
|
||||
}
|
||||
auto gaps = std::vector<HistoryInner::CollapseGap>();
|
||||
gaps.reserve(_collapseGaps.size());
|
||||
auto cumulativeOriginal = 0;
|
||||
for (const auto &g : _collapseGaps) {
|
||||
gaps.push_back({ .absY = g.absY, .height = g.currentHeight });
|
||||
gaps.push_back({
|
||||
.absY = g.absY - cumulativeOriginal,
|
||||
.height = g.currentHeight,
|
||||
});
|
||||
cumulativeOriginal += g.originalHeight;
|
||||
}
|
||||
_list->setCollapseGaps(gaps);
|
||||
}
|
||||
|
||||
@@ -949,6 +949,7 @@ private:
|
||||
int absY = -1;
|
||||
int startHeight = 0;
|
||||
int currentHeight = 0;
|
||||
int originalHeight = 0;
|
||||
};
|
||||
std::vector<CollapseGapState> _collapseGaps;
|
||||
Ui::Animations::Simple _collapseAnimation;
|
||||
|
||||
Reference in New Issue
Block a user