Skip to content

Commit cf00581

Browse files
committed
update zoomstate indentation
1 parent 9896e54 commit cf00581

File tree

1 file changed

+39
-39
lines changed
  • feature/camera/src/main/java/com/android/developers/androidify/camera

1 file changed

+39
-39
lines changed

feature/camera/src/main/java/com/android/developers/androidify/camera/ZoomState.kt

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,49 @@ import androidx.compose.runtime.Stable
2424

2525
@Stable
2626
class ZoomState(
27-
initialZoomLevel: Float,
28-
val zoomRange: ClosedFloatingPointRange<Float>,
29-
val onChangeZoomLevel: (Float) -> Unit,
30-
) {
31-
private var functionalZoom = initialZoomLevel
27+
initialZoomLevel: Float,
28+
val zoomRange: ClosedFloatingPointRange<Float>,
29+
val onChangeZoomLevel: (Float) -> Unit,
30+
) {
31+
private var functionalZoom = initialZoomLevel
3232

33-
private val mutatorMutex = MutatorMutex()
33+
private val mutatorMutex = MutatorMutex()
3434

35-
/**
36-
* Immediately set the current zoom level to [targetZoomLevel].
37-
*/
38-
suspend fun absoluteZoom(targetZoomLevel: Float) {
39-
mutatorMutex.mutate {
40-
functionalZoom = targetZoomLevel.coerceIn(zoomRange)
41-
onChangeZoomLevel(functionalZoom)
35+
/**
36+
* Immediately set the current zoom level to [targetZoomLevel].
37+
*/
38+
suspend fun absoluteZoom(targetZoomLevel: Float) {
39+
mutatorMutex.mutate {
40+
functionalZoom = targetZoomLevel.coerceIn(zoomRange)
41+
onChangeZoomLevel(functionalZoom)
42+
}
4243
}
43-
}
4444

45-
/**
46-
* Scale the current zoom level.
47-
*/
48-
suspend fun scaleZoom(scalingFactor: Float) {
49-
absoluteZoom(scalingFactor * functionalZoom)
50-
}
45+
/**
46+
* Scale the current zoom level.
47+
*/
48+
suspend fun scaleZoom(scalingFactor: Float) {
49+
absoluteZoom(scalingFactor * functionalZoom)
50+
}
5151

52-
/**
53-
* Ease towards a specific zoom level
54-
*
55-
* @param animationSpec [AnimationSpec] used for the animation, default to tween over 500ms
56-
*/
57-
suspend fun animatedZoom(
58-
targetZoomLevel: Float,
59-
animationSpec: AnimationSpec<Float> = tween(durationMillis = 500),
60-
) {
61-
mutatorMutex.mutate {
62-
Animatable(initialValue = functionalZoom).animateTo(
63-
targetValue = targetZoomLevel,
64-
animationSpec = animationSpec,
65-
) {
66-
// this is called every animation frame
67-
functionalZoom = value.coerceIn(zoomRange)
68-
onChangeZoomLevel(functionalZoom)
69-
}
52+
/**
53+
* Ease towards a specific zoom level
54+
*
55+
* @param animationSpec [AnimationSpec] used for the animation, default to tween over 500ms
56+
*/
57+
suspend fun animatedZoom(
58+
targetZoomLevel: Float,
59+
animationSpec: AnimationSpec<Float> = tween(durationMillis = 500),
60+
) {
61+
mutatorMutex.mutate {
62+
Animatable(initialValue = functionalZoom).animateTo(
63+
targetValue = targetZoomLevel,
64+
animationSpec = animationSpec,
65+
) {
66+
// this is called every animation frame
67+
functionalZoom = value.coerceIn(zoomRange)
68+
onChangeZoomLevel(functionalZoom)
69+
}
70+
}
7071
}
71-
}
7272
}

0 commit comments

Comments
 (0)