From 2a950ce36e61c3344df6538b8f4eec515675d194 Mon Sep 17 00:00:00 2001 From: Zoltan Gera Date: Wed, 14 Feb 2024 14:56:00 +0200 Subject: [PATCH] Android: Do not double finger size for touch events Fingers in touch events are modelled by rotated ellipses with their major and minor axes stored respectively. The axis is the diameter of the ellipse in one direction, not its radius. These values should be converted to a rectangle correctly, without doubling their extents. The pair of this fixed code is located in function QWindowSystemInterfacePrivate::fromNativeTouchPoints(). Change-Id: I4fea7e8168a9c248a744964d4821b774b85a6cf4 Reviewed-by: Assam Boudjelthia (cherry picked from commit 9a0098f4b34e88f28d3d5d6d88948dcf8606e7b3) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/android/androidjniinput.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 9ae39269fbd..00e6b7ca51d 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -287,10 +287,10 @@ namespace QtAndroidInput touchPoint.rotation = qRadiansToDegrees(rotation); touchPoint.normalPosition = QPointF(double(x / dw), double(y / dh)); touchPoint.state = state; - touchPoint.area = QRectF(x - double(minor), - y - double(major), - double(minor * 2), - double(major * 2)); + touchPoint.area = QRectF(x - double(minor * 0.5f), + y - double(major * 0.5f), + double(minor), + double(major)); m_touchPoints.push_back(touchPoint); if (state == QEventPoint::State::Pressed) { QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();