Skip to content

Commit

Permalink
Android: Do not double finger size for touch events
Browse files Browse the repository at this point in the history
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 <assam.boudjelthia@qt.io>
(cherry picked from commit 9a0098f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
  • Loading branch information
Zoltan Gera authored and Qt Cherry-pick Bot committed Feb 16, 2024
1 parent 2cfe719 commit 2a950ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plugins/platforms/android/androidjniinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2a950ce

Please sign in to comment.