Do pixel<->angle delta conversion right
This commit is contained in:
parent
4dd604e61e
commit
fb3d00bab0
3 changed files with 5 additions and 2 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
#include "ui/platform/win/ui_windows_direct_manipulation.h"
|
#include "ui/platform/win/ui_windows_direct_manipulation.h"
|
||||||
#include "ui/platform/ui_platform_utility.h"
|
#include "ui/platform/ui_platform_utility.h"
|
||||||
#include "ui/widgets/rp_window.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/win/base_windows_safe_library.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/integration.h"
|
#include "base/integration.h"
|
||||||
|
|
@ -505,7 +506,7 @@ void WindowHelper::handleDirectManipulationEvent(
|
||||||
QPointF(local.x, local.y),
|
QPointF(local.x, local.y),
|
||||||
QPointF(global.x, global.y),
|
QPointF(global.x, global.y),
|
||||||
event.delta,
|
event.delta,
|
||||||
event.delta,
|
event.delta * kPixelToAngleDelta,
|
||||||
LookupModifiers(),
|
LookupModifiers(),
|
||||||
phase,
|
phase,
|
||||||
Qt::MouseEventSynthesizedBySystem);
|
Qt::MouseEventSynthesizedBySystem);
|
||||||
|
|
|
||||||
|
|
@ -1280,7 +1280,7 @@ QPoint ScrollDelta(not_null<QWheelEvent*> e) {
|
||||||
|| (Platform::IsWindows() && e->phase() != Qt::NoScrollPhase)) {
|
|| (Platform::IsWindows() && e->phase() != Qt::NoScrollPhase)) {
|
||||||
return convert(e->pixelDelta());
|
return convert(e->pixelDelta());
|
||||||
}
|
}
|
||||||
return convert(e->angleDelta() * style::DevicePixelRatio());
|
return convert(e->angleDelta() / kPixelToAngleDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ extern const style::ScrollArea &defaultScrollArea;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
|
constexpr auto kPixelToAngleDelta = 10;
|
||||||
|
|
||||||
struct ScrollState {
|
struct ScrollState {
|
||||||
int visibleFrom = 0;
|
int visibleFrom = 0;
|
||||||
int visibleTill = 0;
|
int visibleTill = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue