Change the offset computation for front cameras (#112)

pull/52/merge
Mattia Iavarone 7 years ago committed by GitHub
parent 3bc6d96ac3
commit ced60586c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java

@ -406,8 +406,9 @@ abstract class CameraController implements
*/
protected final int computeSensorToViewOffset() {
if (mFacing == Facing.FRONT) {
// or: (360 - ((mSensorOffset + mDisplayOffset) % 360)) % 360;
return ((mSensorOffset - mDisplayOffset) + 360 + 180) % 360;
// Here we had ((mSensorOffset - mDisplayOffset) + 360 + 180) % 360
// And it seemed to give the same results for various combinations, but not for all (e.g. 0 - 270).
return (360 - ((mSensorOffset + mDisplayOffset) % 360)) % 360;
} else {
return (mSensorOffset - mDisplayOffset + 360) % 360;
}

Loading…
Cancel
Save