Revert "Revert orientation tracking on the camera image"

This reverts commit 4f8661f648.
This commit is contained in:
Ole-Morten Duesund 2026-05-11 15:29:59 +02:00
commit c0bab85d63
7 changed files with 171 additions and 55 deletions

View file

@ -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 {