From 6ff9eb237b1f9ef1f516a53e5fa461eceb11dfd7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 31 Dec 2023 18:58:42 +0400 Subject: [PATCH] Improve scrolling constants. --- ui/widgets/elastic_scroll.cpp | 6 +++--- ui/widgets/elastic_scroll.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/widgets/elastic_scroll.cpp b/ui/widgets/elastic_scroll.cpp index f20dc81..3abbdf9 100644 --- a/ui/widgets/elastic_scroll.cpp +++ b/ui/widgets/elastic_scroll.cpp @@ -1275,12 +1275,12 @@ QPoint ScrollDelta(not_null e) { const auto convert = [](QPoint point) { return QPoint( style::ConvertScale(point.x()), - style::ConvertScale(point.y())) * kMagicScrollMultiplier; + style::ConvertScale(point.y())); }; 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 diff --git a/ui/widgets/elastic_scroll.h b/ui/widgets/elastic_scroll.h index 3113dc8..d8ca3b1 100644 --- a/ui/widgets/elastic_scroll.h +++ b/ui/widgets/elastic_scroll.h @@ -22,7 +22,7 @@ extern const style::ScrollArea &defaultScrollArea; namespace Ui { -constexpr auto kPixelToAngleDelta = 10; +inline constexpr auto kPixelToAngleDelta = 2; struct ScrollState { int visibleFrom = 0;