Skip to content

Commit 4b5a61e

Browse files
update zoom demos
1 parent ac9c6b8 commit 4b5a61e

File tree

6 files changed

+398
-19
lines changed

6 files changed

+398
-19
lines changed

app/src/main/java/com/smarttoolfactory/composeimage/demo/zoom/AnimatedZoomDemo.kt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import androidx.compose.runtime.Composable
1010
import androidx.compose.ui.Modifier
1111
import androidx.compose.ui.graphics.Color
1212
import androidx.compose.ui.unit.dp
13-
import com.smarttoolfactory.image.zoom.AnimatedZoomLayout2
13+
import com.smarttoolfactory.image.zoom.AnimatedZoomLayout
1414

1515
@Composable
1616
fun AnimatedZoomDemo() {
1717

1818
Column(modifier = Modifier.fillMaxSize()) {
19-
AnimatedZoomLayout2(
19+
AnimatedZoomLayout(
2020
modifier = Modifier
2121
.fillMaxSize()
2222
.border(2.dp, Color.Green)
@@ -31,19 +31,5 @@ fun AnimatedZoomDemo() {
3131
" asads dasdasdasd asdasdasd",
3232
)
3333
}
34-
35-
// AnimatedZoomLayout2(
36-
// modifier = Modifier
37-
// .fillMaxWidth()
38-
//
39-
// .border(2.dp, Color.Green)
40-
// ) {
41-
// Text(
42-
// modifier = Modifier
43-
// .size(100.dp)
44-
// .background(Color.Yellow),
45-
// text = "Hello World",
46-
// )
47-
// }
4834
}
4935
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.smarttoolfactory.composeimage.demo.zoom
2+
3+
import androidx.compose.foundation.clickable
4+
import androidx.compose.foundation.layout.*
5+
import androidx.compose.material.Checkbox
6+
import androidx.compose.material.Text
7+
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.Alignment
9+
import androidx.compose.ui.Modifier
10+
import androidx.compose.ui.semantics.Role
11+
import androidx.compose.ui.unit.dp
12+
13+
@Composable
14+
fun CheckBoxWithTitle(
15+
label: String,
16+
state: Boolean,
17+
onStateChange: (Boolean) -> Unit
18+
) {
19+
Row(modifier = Modifier
20+
.fillMaxWidth()
21+
.height(40.dp)
22+
.clickable(
23+
role = Role.Checkbox,
24+
onClick = {
25+
onStateChange(!state)
26+
}
27+
)
28+
.padding(8.dp),
29+
verticalAlignment = Alignment.CenterVertically
30+
) {
31+
Checkbox(
32+
checked = state,
33+
onCheckedChange = null
34+
)
35+
Spacer(modifier = Modifier.width(8.dp))
36+
Text(text = label)
37+
}
38+
}

app/src/main/java/com/smarttoolfactory/composeimage/demo/zoom/EnhancedZoomDemo.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ fun EnhancedZoomDemo() {
5151
contentScale = it
5252
}
5353

54+
// EnhancedZoomableImage(
55+
// modifier=Modifier.fillMaxSize(),
56+
// contentScale= ContentScale.FillBounds,
57+
// imageBitmap = imageBitmapLarge, zoomState = rememberEnhancedZoomState(
58+
// imageSize = IntSize(imageBitmapLarge.width, imageBitmapLarge.height),
59+
// limitPan = true,
60+
// fling = true,
61+
// moveToBounds = false,
62+
// minZoom = 1f,
63+
// maxZoom = 10f
64+
// ))
65+
5466
EnhancedZoomableImageSample(imageBitmap = imageBitmapLarge, contentScale)
5567
EnhancedZoomModifierSample(imageBitmap = imageBitmapLarge)
5668
CallbackAndCropSample(imageBitmap = imageBitmapLarge)

app/src/main/java/com/smarttoolfactory/composeimage/demo/zoom/ZoomableImageDemo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ private fun ZoomModifierDemo() {
298298

299299
@Composable
300300
private fun DrawPolygonPath(modifier: Modifier) {
301-
var sides by remember { mutableStateOf(3f) }
301+
var sides by remember { mutableStateOf(6f) }
302302
var cornerRadius by remember { mutableStateOf(1f) }
303303

304304
Canvas(modifier = modifier) {

0 commit comments

Comments
 (0)