mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-28 11:30:54 +00:00
Fixed scrolling with touchpad in vertical drum picker.
This commit is contained in:
parent
7fda14ccca
commit
6a7cbc545f
@ -135,13 +135,24 @@ void VerticalDrumPicker::handleWheelEvent(not_null<QWheelEvent*> e) {
|
|||||||
if (direction) {
|
if (direction) {
|
||||||
_animation.jumpToOffset(direction);
|
_animation.jumpToOffset(direction);
|
||||||
} else {
|
} else {
|
||||||
const auto delta = e->pixelDelta().y()
|
if (const auto delta = e->pixelDelta().y(); delta) {
|
||||||
? e->pixelDelta().y()
|
increaseShift(delta / float64(_itemHeight));
|
||||||
: e->angleDelta().y();
|
} else if (e->phase() == Qt::ScrollEnd) {
|
||||||
increaseShift(delta / float64(_itemHeight));
|
|
||||||
if (e->phase() == Qt::ScrollEnd) {
|
|
||||||
animationDataFromIndex();
|
animationDataFromIndex();
|
||||||
_animation.jumpToOffset(0);
|
_animation.jumpToOffset(0);
|
||||||
|
} else {
|
||||||
|
constexpr auto step = int(QWheelEvent::DefaultDeltasPerStep);
|
||||||
|
|
||||||
|
_touch.verticalDelta += e->angleDelta().y();
|
||||||
|
while (std::abs(_touch.verticalDelta) >= step) {
|
||||||
|
if (_touch.verticalDelta < 0) {
|
||||||
|
_touch.verticalDelta += step;
|
||||||
|
_animation.jumpToOffset(1);
|
||||||
|
} else {
|
||||||
|
_touch.verticalDelta -= step;
|
||||||
|
_animation.jumpToOffset(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,10 @@ private:
|
|||||||
bool clickDisabled = false;
|
bool clickDisabled = false;
|
||||||
} _mouse;
|
} _mouse;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int verticalDelta = 0;
|
||||||
|
} _touch;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
Loading…
Reference in New Issue
Block a user