diff --git a/Telegram/SourceFiles/ui/controls/sub_tabs.cpp b/Telegram/SourceFiles/ui/controls/sub_tabs.cpp index 1d5fdfda42..e5c6e616e9 100644 --- a/Telegram/SourceFiles/ui/controls/sub_tabs.cpp +++ b/Telegram/SourceFiles/ui/controls/sub_tabs.cpp @@ -192,8 +192,28 @@ void SubTabs::mouseMoveEvent(QMouseEvent *e) { void SubTabs::wheelEvent(QWheelEvent *e) { const auto delta = ScrollDeltaF(e); - if (std::abs(delta.x()) > std::abs(delta.y())) { + + const auto phase = e->phase(); + const auto horizontal = (std::abs(delta.x()) > std::abs(delta.y())); + if (phase == Qt::NoScrollPhase) { + _locked = std::nullopt; + } else if (phase == Qt::ScrollBegin) { + _locked = std::nullopt; + } else if (!_locked) { + _locked = horizontal ? Qt::Horizontal : Qt::Vertical; + } + if (horizontal) { + if (_locked == Qt::Vertical) { + return; + } e->accept(); + } else { + if (_locked == Qt::Horizontal) { + e->accept(); + } else { + e->ignore(); + } + return; } _scrollAnimation.stop(); _scroll = std::clamp(_scroll - delta.x(), 0., _scrollMax * 1.); diff --git a/Telegram/SourceFiles/ui/controls/sub_tabs.h b/Telegram/SourceFiles/ui/controls/sub_tabs.h index ea089926db..63bf2c27c2 100644 --- a/Telegram/SourceFiles/ui/controls/sub_tabs.h +++ b/Telegram/SourceFiles/ui/controls/sub_tabs.h @@ -69,6 +69,7 @@ private: std::vector