Skip to content

Commit fa61a04

Browse files
committed
Merge pull request asennikov#6 from asennikov/fix-orientation-on-android-tablets
Fix orientation issues
2 parents 1af903f + 94c0ad8 commit fa61a04

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/android/CanvasCamera.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,16 @@ private void setCurrentRotation() {
280280

281281
int surfaceRotation = mActivity.getWindowManager().getDefaultDisplay().getRotation();
282282

283+
int correction = cameraInfo.orientation - 90;
284+
283285
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
284286
switch (surfaceRotation) {
285-
case Surface.ROTATION_0: mRotation = 180; break;
286-
case Surface.ROTATION_90: mRotation = 0; break;
287-
case Surface.ROTATION_180: mRotation = 180; break;
288-
case Surface.ROTATION_270: mRotation = 0; break;
287+
case Surface.ROTATION_90: correction += 180; break;
288+
case Surface.ROTATION_270: correction += 180; break;
289289
}
290-
} else { // back-facing
291-
mRotation = 0;
292290
}
291+
292+
mRotation = correction;
293293
}
294294
}
295295

@@ -320,7 +320,7 @@ private String getOptimalFocusMode(Camera.Parameters params) {
320320
} else {
321321
result = params.getSupportedFocusModes().get(0);
322322
}
323-
323+
324324
return result;
325325
}
326326

0 commit comments

Comments
 (0)