mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-02-18 12:20:36 +01:00
minor update
This commit is contained in:
parent
207bb44eed
commit
0eed22d749
@ -1,15 +1,15 @@
|
|||||||
package com.simplemobiletools.camera.extensions
|
package com.simplemobiletools.camera.extensions
|
||||||
|
|
||||||
import android.hardware.Camera
|
import android.hardware.Camera
|
||||||
import com.simplemobiletools.camera.Constants
|
import com.simplemobiletools.camera.ORIENT_LANDSCAPE_LEFT
|
||||||
|
import com.simplemobiletools.camera.ORIENT_LANDSCAPE_RIGHT
|
||||||
|
|
||||||
fun Int.compensateDeviceRotation(currCameraId: Int): Int {
|
fun Int.compensateDeviceRotation(currCameraId: Int): Int {
|
||||||
var degrees = 0
|
|
||||||
val isFrontCamera = currCameraId == Camera.CameraInfo.CAMERA_FACING_FRONT
|
val isFrontCamera = currCameraId == Camera.CameraInfo.CAMERA_FACING_FRONT
|
||||||
if (this == Constants.ORIENT_LANDSCAPE_LEFT) {
|
return if (this == ORIENT_LANDSCAPE_LEFT) {
|
||||||
degrees += if (isFrontCamera) 90 else 270
|
if (isFrontCamera) 90 else 270
|
||||||
} else if (this == Constants.ORIENT_LANDSCAPE_RIGHT) {
|
} else if (this == ORIENT_LANDSCAPE_RIGHT) {
|
||||||
degrees += if (isFrontCamera) 270 else 90
|
if (isFrontCamera) 270 else 90
|
||||||
}
|
} else
|
||||||
return degrees
|
0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user