Change the offset computation for front cameras

pull/112/head
Mattia Iavarone 8 years ago
parent 3bc6d96ac3
commit ec439561f7
  1. 5
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java

@ -406,8 +406,9 @@ abstract class CameraController implements
*/ */
protected final int computeSensorToViewOffset() { protected final int computeSensorToViewOffset() {
if (mFacing == Facing.FRONT) { if (mFacing == Facing.FRONT) {
// or: (360 - ((mSensorOffset + mDisplayOffset) % 360)) % 360; // Here we had ((mSensorOffset - mDisplayOffset) + 360 + 180) % 360
return ((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 { } else {
return (mSensorOffset - mDisplayOffset + 360) % 360; return (mSensorOffset - mDisplayOffset + 360) % 360;
} }

Loading…
Cancel
Save