Android: populate TouchPoint rotation and axes correctly
We model each TouchPoint contact patch as an ellipse now, which is consistent with Android APIs. Change-Id: I4edfbebfb5e1ab6686dba0ec924bfcfbbd6ff0f4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>bb10
parent
9dd4381b69
commit
80fa5f6e76
|
|
@ -411,7 +411,9 @@ public class QtNative
|
|||
i == 0,
|
||||
(int)event.getX(i),
|
||||
(int)event.getY(i),
|
||||
event.getSize(i),
|
||||
event.getTouchMajor(i),
|
||||
event.getTouchMinor(i),
|
||||
event.getOrientation(i),
|
||||
event.getPressure(i));
|
||||
}
|
||||
|
||||
|
|
@ -779,7 +781,7 @@ public class QtNative
|
|||
public static native void mouseUp(int winId, int x, int y);
|
||||
public static native void mouseMove(int winId, int x, int y);
|
||||
public static native void touchBegin(int winId);
|
||||
public static native void touchAdd(int winId, int pointerId, int action, boolean primary, int x, int y, float size, float pressure);
|
||||
public static native void touchAdd(int winId, int pointerId, int action, boolean primary, int x, int y, float major, float minor, float rotation, float pressure);
|
||||
public static native void touchEnd(int winId, int action);
|
||||
public static native void longPress(int winId, int x, int y);
|
||||
// pointer methods
|
||||
|
|
|
|||
|
|
@ -206,7 +206,8 @@ namespace QtAndroidInput
|
|||
m_touchPoints.clear();
|
||||
}
|
||||
|
||||
static void touchAdd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint id, jint action, jboolean /*primary*/, jint x, jint y, jfloat size, jfloat pressure)
|
||||
static void touchAdd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint id, jint action, jboolean /*primary*/, jint x, jint y,
|
||||
jfloat major, jfloat minor, jfloat rotation, jfloat pressure)
|
||||
{
|
||||
Qt::TouchPointState state = Qt::TouchPointStationary;
|
||||
switch (action) {
|
||||
|
|
@ -229,12 +230,13 @@ namespace QtAndroidInput
|
|||
QWindowSystemInterface::TouchPoint touchPoint;
|
||||
touchPoint.id = id;
|
||||
touchPoint.pressure = pressure;
|
||||
touchPoint.rotation = rotation * 180 / M_PI;
|
||||
touchPoint.normalPosition = QPointF(double(x / dw), double(y / dh));
|
||||
touchPoint.state = state;
|
||||
touchPoint.area = QRectF(x - double(dw*size) / 2.0,
|
||||
y - double(dh*size) / 2.0,
|
||||
double(dw*size),
|
||||
double(dh*size));
|
||||
touchPoint.area = QRectF(x - double(minor),
|
||||
y - double(major),
|
||||
double(minor * 2),
|
||||
double(major * 2));
|
||||
m_touchPoints.push_back(touchPoint);
|
||||
|
||||
if (state == Qt::TouchPointPressed) {
|
||||
|
|
@ -817,7 +819,7 @@ namespace QtAndroidInput
|
|||
|
||||
static JNINativeMethod methods[] = {
|
||||
{"touchBegin","(I)V",(void*)touchBegin},
|
||||
{"touchAdd","(IIIZIIFF)V",(void*)touchAdd},
|
||||
{"touchAdd","(IIIZIIFFFF)V",(void*)touchAdd},
|
||||
{"touchEnd","(II)V",(void*)touchEnd},
|
||||
{"mouseDown", "(III)V", (void *)mouseDown},
|
||||
{"mouseUp", "(III)V", (void *)mouseUp},
|
||||
|
|
|
|||
Loading…
Reference in New Issue