mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Fix scrolling in SubTabs.
This commit is contained in:
@@ -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.);
|
||||
|
||||
@@ -69,6 +69,7 @@ private:
|
||||
std::vector<Button> _buttons;
|
||||
rpl::event_stream<QString> _activated;
|
||||
rpl::event_stream<QString> _contextMenuRequests;
|
||||
std::optional<Qt::Orientation> _locked;
|
||||
int _dragx = 0;
|
||||
int _pressx = 0;
|
||||
float64 _dragscroll = 0.;
|
||||
|
||||
Reference in New Issue
Block a user