Map zoom bar to zoom ratio instead of linear zoom

Linear zoom 0 switches to the ultra-wide lens on devices
that support it, causing blurry images. Mapping to zoom ratios
from 1.0x to maxZoomRatio keeps the main lens in use.
This commit is contained in:
Markus Fisch
2026-03-17 21:54:34 +01:00
parent bc2be96871
commit 909e97a591
@@ -624,7 +624,11 @@ class CameraActivity : AppCompatActivity() {
progress: Int,
fromUser: Boolean
) {
camera?.cameraControl?.setLinearZoom(progress / 100f)
val maxRatio = camera?.cameraInfo?.zoomState?.value
?.maxZoomRatio ?: return
camera?.cameraControl?.setZoomRatio(
1f + progress / 100f * (maxRatio - 1f)
)
}
override fun onStartTrackingTouch(seekBar: SeekBar) {