Skip to content

Commit

Permalink
fixed touch issue in larger screen
Browse files Browse the repository at this point in the history
  • Loading branch information
andresoviedo committed Jul 25, 2022
1 parent 0b93381 commit 662b4f6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
Binary file modified app/build/outputs/apk/release/app-release.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,13 @@ else if (event instanceof ViewEvent) {
}
return true;
}

@Override
public void onBackPressed() {
if (immersiveMode) {
toggleImmersive();
} else {
super.onBackPressed();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,23 @@ public boolean onMotionEvent(MotionEvent motionEvent) {

// gesture detection
isOneFixedAndOneMoving = ((dx1 + dy1) == 0) != (((dx2 + dy2) == 0));
fingersAreClosing = (Math.abs(dx1 + dx2) < 5 && Math.abs(dy1 + dy2) < 5);
fingersAreClosing = (Math.abs(dx1 + dx2) < 10 && Math.abs(dy1 + dy2) < 10);
isRotating = !isOneFixedAndOneMoving && (dx1 != 0 && dy1 != 0 && dx2 != 0 && dy2 != 0);
}

if (pointerCount == 1 && simpleTouch) {
fireEvent(new TouchEvent(this, TouchEvent.CLICK, width, height, x1, y1));
} else {
if (touchDelay > 2) {
//if (touchDelay > 1) {
// INFO: Process gesture
if (pointerCount == 1 && currentPress1 > 4.0f) {
} else if (pointerCount == 1) {
/*if (pointerCount == 1 && currentPress1 > 4.0f) {
} else */if (pointerCount == 1) {
fireEvent(new TouchEvent(this, TouchEvent.MOVE, width, height, previousX1, previousY1,
x1, y1, dx1, dy1, 0,
0f));
touchStatus = TOUCH_STATUS_MOVING_WORLD;
} else if (pointerCount == 2) {
if (fingersAreClosing && (currentPress1 + currentPress2) > 1f) {
if (fingersAreClosing) {
fireEvent(new TouchEvent(this, TouchEvent.PINCH, width, height, previousX1, previousY1,
x1, y1, dx1, dy1, (previousLength - length), 0f));
touchStatus = TOUCH_STATUS_ZOOMING_CAMERA;
Expand All @@ -221,7 +221,7 @@ public boolean onMotionEvent(MotionEvent motionEvent) {
}
}
}
}
//}
}

previousX1 = x1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,11 @@ public void onDrawFrame(GL10 unused) {
float ratio = (float) width / height;
// Log.v(TAG, "Camera changed: projection: [" + -ratio + "," + ratio + ",-1,1]-near/far[1,10], ");

if (!scene.isStereoscopic()) {
Matrix.setLookAtM(viewMatrix, 0, camera.getxPos(), camera.getyPos(), camera.getzPos(), camera.getxView(), camera.getyView(),
camera.getzView(), camera.getxUp(), camera.getyUp(), camera.getzUp());
Matrix.multiplyMM(viewProjectionMatrix, 0, projectionMatrix, 0, viewMatrix, 0);
} else {
Matrix.setLookAtM(viewMatrix, 0, camera.getxPos(), camera.getyPos(), camera.getzPos(), camera.getxView(), camera.getyView(),
camera.getzView(), camera.getxUp(), camera.getyUp(), camera.getzUp());
Matrix.multiplyMM(viewProjectionMatrix, 0, projectionMatrix, 0, viewMatrix, 0);

if (scene.isStereoscopic()) {
Camera[] stereoCamera = camera.toStereo(Constants.EYE_DISTANCE);
Camera leftCamera = stereoCamera[0];
Camera rightCamera = stereoCamera[1];
Expand Down

0 comments on commit 662b4f6

Please sign in to comment.