Do pixel<->angle delta conversion right

This commit is contained in:
Ilya Fedin 2023-12-23 16:40:25 +04:00 committed by John Preston
parent 4dd604e61e
commit fb3d00bab0
3 changed files with 5 additions and 2 deletions

View file

@ -11,6 +11,7 @@
#include "ui/platform/win/ui_windows_direct_manipulation.h"
#include "ui/platform/ui_platform_utility.h"
#include "ui/widgets/rp_window.h"
#include "ui/widgets/elastic_scroll.h"
#include "base/platform/win/base_windows_safe_library.h"
#include "base/platform/base_platform_info.h"
#include "base/integration.h"
@ -505,7 +506,7 @@ void WindowHelper::handleDirectManipulationEvent(
QPointF(local.x, local.y),
QPointF(global.x, global.y),
event.delta,
event.delta,
event.delta * kPixelToAngleDelta,
LookupModifiers(),
phase,
Qt::MouseEventSynthesizedBySystem);

View file

@ -1280,7 +1280,7 @@ QPoint ScrollDelta(not_null<QWheelEvent*> e) {
|| (Platform::IsWindows() && e->phase() != Qt::NoScrollPhase)) {
return convert(e->pixelDelta());
}
return convert(e->angleDelta() * style::DevicePixelRatio());
return convert(e->angleDelta() / kPixelToAngleDelta);
}
} // namespace Ui

View file

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