Fix restoring scroll state with a pinned bar.
This commit is contained in:
parent
07f07c5eeb
commit
a21b6d7416
2 changed files with 6 additions and 1 deletions
|
@ -3230,6 +3230,9 @@ void HistoryWidget::doneShow() {
|
||||||
} else {
|
} else {
|
||||||
handlePendingHistoryUpdate();
|
handlePendingHistoryUpdate();
|
||||||
}
|
}
|
||||||
|
// If we show pinned bar here, we don't want it to change the
|
||||||
|
// calculated and prepared scrollTop of the messages history.
|
||||||
|
_preserveScrollTop = true;
|
||||||
preloadHistoryIfNeeded();
|
preloadHistoryIfNeeded();
|
||||||
updatePinnedViewer();
|
updatePinnedViewer();
|
||||||
if (_pinnedBar) {
|
if (_pinnedBar) {
|
||||||
|
@ -3237,6 +3240,7 @@ void HistoryWidget::doneShow() {
|
||||||
}
|
}
|
||||||
checkHistoryActivation();
|
checkHistoryActivation();
|
||||||
App::wnd()->setInnerFocus();
|
App::wnd()->setInnerFocus();
|
||||||
|
_preserveScrollTop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::finishAnimating() {
|
void HistoryWidget::finishAnimating() {
|
||||||
|
@ -5330,7 +5334,7 @@ void HistoryWidget::checkPinnedBarState() {
|
||||||
_pinnedBarHeight = 0;
|
_pinnedBarHeight = 0;
|
||||||
_pinnedBar->heightValue(
|
_pinnedBar->heightValue(
|
||||||
) | rpl::start_with_next([=](int height) {
|
) | rpl::start_with_next([=](int height) {
|
||||||
_topDelta = (height - _pinnedBarHeight);
|
_topDelta = _preserveScrollTop ? 0 : (height - _pinnedBarHeight);
|
||||||
_pinnedBarHeight = height;
|
_pinnedBarHeight = height;
|
||||||
updateHistoryGeometry();
|
updateHistoryGeometry();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
|
|
|
@ -599,6 +599,7 @@ private:
|
||||||
std::unique_ptr<HistoryView::PinnedTracker> _pinnedTracker;
|
std::unique_ptr<HistoryView::PinnedTracker> _pinnedTracker;
|
||||||
std::unique_ptr<Ui::PinnedBar> _pinnedBar;
|
std::unique_ptr<Ui::PinnedBar> _pinnedBar;
|
||||||
int _pinnedBarHeight = 0;
|
int _pinnedBarHeight = 0;
|
||||||
|
bool _preserveScrollTop = false;
|
||||||
FullMsgId _pinnedClickedId;
|
FullMsgId _pinnedClickedId;
|
||||||
std::optional<FullMsgId> _minPinnedId;
|
std::optional<FullMsgId> _minPinnedId;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue