2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 10:17:10 +00:00

Scroll a bit further when switching tabs.

This commit is contained in:
John Preston 2025-08-14 17:01:34 +04:00
parent f9bf40a771
commit 7f2a0b6630

View File

@ -237,6 +237,12 @@ void SubsectionTabs::setupSlider(
slider->requestShown(
) | rpl::start_with_next([=](Ui::ScrollToRequest request) {
const auto full = vertical ? scroll->height() : scroll->width();
const auto tab = request.ymax - request.ymin;
if (tab < full) {
const auto add = std::min(full - tab, tab) / 2;
request.ymax += add;
request.ymin -= add;
}
const auto scrollValue = vertical
? scroll->scrollTop()
: scroll->scrollLeft();