Improve scrolling constants.

This commit is contained in:
John Preston 2023-12-31 18:58:42 +04:00
parent 88f53cf1d9
commit 6ff9eb237b
2 changed files with 4 additions and 4 deletions

View file

@ -1275,12 +1275,12 @@ QPoint ScrollDelta(not_null<QWheelEvent*> e) {
const auto convert = [](QPoint point) { const auto convert = [](QPoint point) {
return QPoint( return QPoint(
style::ConvertScale(point.x()), style::ConvertScale(point.x()),
style::ConvertScale(point.y())) * kMagicScrollMultiplier; style::ConvertScale(point.y()));
}; };
if (!e->pixelDelta().isNull()) { if (!e->pixelDelta().isNull()) {
return convert(e->pixelDelta()); return convert(e->pixelDelta()) * kMagicScrollMultiplier;
} }
return convert(e->angleDelta() / kPixelToAngleDelta); return convert(e->angleDelta()) / kPixelToAngleDelta;
} }
} // namespace Ui } // namespace Ui

View file

@ -22,7 +22,7 @@ extern const style::ScrollArea &defaultScrollArea;
namespace Ui { namespace Ui {
constexpr auto kPixelToAngleDelta = 10; inline constexpr auto kPixelToAngleDelta = 2;
struct ScrollState { struct ScrollState {
int visibleFrom = 0; int visibleFrom = 0;