Revert "Revert orientation tracking on the camera image"
This reverts commit 4f8661f648.
This commit is contained in:
parent
4f8661f648
commit
c0bab85d63
7 changed files with 171 additions and 55 deletions
|
|
@ -112,6 +112,7 @@ fun CameraScreen(
|
|||
val isFrontCamera by viewModel.cameraManager.isFrontCamera.collectAsState()
|
||||
val previewResolution by viewModel.cameraManager.previewResolution.collectAsState()
|
||||
val cameraError by viewModel.cameraManager.error.collectAsState()
|
||||
val currentRotation by viewModel.currentRotation.collectAsState()
|
||||
|
||||
// Gallery picker
|
||||
val galleryLauncher = rememberLauncherForActivityResult(
|
||||
|
|
@ -164,6 +165,13 @@ fun CameraScreen(
|
|||
}
|
||||
}
|
||||
|
||||
// Forward device rotation to renderer (aspect math) and CameraX (target rotation)
|
||||
LaunchedEffect(currentRotation, renderer) {
|
||||
renderer?.setDisplayRotation(currentRotation)
|
||||
viewModel.cameraManager.setTargetRotation(currentRotation)
|
||||
glSurfaceView?.requestRender()
|
||||
}
|
||||
|
||||
// Start camera when surface texture is available
|
||||
LaunchedEffect(surfaceTexture) {
|
||||
surfaceTexture?.let {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue