-
Notifications
You must be signed in to change notification settings - Fork 14
Zoom
Lucas Yuji edited this page Nov 3, 2022
·
1 revision
To initialize zoom as a state, just use the code like the example below:
val cameraState = rememberCameraState()
var zoomRatio by remember { mutableStateOf(cameraState.minZoom) }
CameraPreview(
cameraState = cameraState,
zoomRatio = zoomRatio
onZoomRatioChanged = { zoomRatio = it },
isPinchToZoomEnabled = true, // default is true
)
addition: isPinchToZoomEnabled
just works if you set zoom
+ onZoomRatioChanged
, otherwise doesn't apply the zoom because the CameraPreview
is stateless.
The camera state has some properties it might be useful for you
- minZoom: get min zoom from CamSelector
- maxZoom: get max zoom from CamSelector
- isZoomSupported: check if zoom is supported in the CamSelector