@@ -18,18 +18,14 @@ package com.google.android.samples.socialite.ui.camera
18
18
19
19
import android.view.Display
20
20
import android.view.View
21
- import androidx.camera.core.AspectRatio
22
21
import androidx.camera.core.Preview
23
22
import androidx.camera.view.PreviewView
24
23
import androidx.compose.foundation.background
25
24
import androidx.compose.foundation.gestures.detectTapGestures
26
25
import androidx.compose.foundation.gestures.rememberTransformableState
27
26
import androidx.compose.foundation.gestures.transformable
28
27
import androidx.compose.foundation.layout.Box
29
- import androidx.compose.foundation.layout.BoxWithConstraints
30
28
import androidx.compose.foundation.layout.fillMaxSize
31
- import androidx.compose.foundation.layout.height
32
- import androidx.compose.foundation.layout.width
33
29
import androidx.compose.runtime.Composable
34
30
import androidx.compose.runtime.getValue
35
31
import androidx.compose.runtime.mutableStateOf
@@ -55,7 +51,7 @@ fun ViewFinder(
55
51
onZoomChange(zoomChange)
56
52
},
57
53
)
58
- BoxWithConstraints (
54
+ Box (
59
55
Modifier
60
56
.background(Color .Black )
61
57
.fillMaxSize()
@@ -76,15 +72,8 @@ fun ViewFinder(
76
72
},
77
73
contentAlignment = Alignment .Center ,
78
74
) {
79
- val maxAspectRatio: Float = maxWidth / maxHeight
80
- val aspectRatio: Float = CameraViewModel .aspectRatios.getValue(AspectRatio .RATIO_16_9 )
81
- val shouldUseMaxWidth = maxAspectRatio <= aspectRatio
82
- val width = if (shouldUseMaxWidth) maxWidth else maxHeight * aspectRatio
83
- val height = if (! shouldUseMaxWidth) maxHeight else maxWidth / aspectRatio
84
75
Box (
85
76
modifier = Modifier
86
- .width(width)
87
- .height(height)
88
77
.transformable(state = transformableState),
89
78
) {
90
79
CameraPreview (
0 commit comments