@@ -6,12 +6,14 @@ import android.widget.Toast.LENGTH_SHORT
6
6
import androidx.activity.ComponentActivity
7
7
import androidx.activity.compose.setContent
8
8
import androidx.compose.animation.animateColorAsState
9
+ import androidx.compose.foundation.layout.Column
9
10
import androidx.compose.foundation.layout.fillMaxSize
10
11
import androidx.compose.foundation.layout.padding
11
12
import androidx.compose.foundation.shape.RoundedCornerShape
12
13
import androidx.compose.material.Button
13
14
import androidx.compose.material.ButtonDefaults
14
15
import androidx.compose.material.FloatingActionButton
16
+ import androidx.compose.material.MaterialTheme
15
17
import androidx.compose.material.Text
16
18
import androidx.compose.runtime.getValue
17
19
import androidx.compose.runtime.mutableStateOf
@@ -46,17 +48,35 @@ public class ViewAnnotationActivity : ComponentActivity() {
46
48
var showViewAnnotation by remember {
47
49
mutableStateOf(true )
48
50
}
51
+ var allowZElevate by remember {
52
+ mutableStateOf(true )
53
+ }
49
54
val animatedColor by animateColorAsState(buttonColor, label = " ButtonAnnotationColor" )
50
55
MapboxMapComposeTheme {
51
56
ExampleScaffold (
52
57
floatingActionButton = {
53
- FloatingActionButton (
54
- onClick = {
55
- showViewAnnotation = ! showViewAnnotation
56
- },
57
- shape = RoundedCornerShape (16 .dp),
58
- ) {
59
- Text (modifier = Modifier .padding(10 .dp), text = " Toggle Visibility" )
58
+ Column {
59
+ FloatingActionButton (
60
+ modifier = Modifier .padding(bottom = 10 .dp),
61
+ onClick = {
62
+ showViewAnnotation = ! showViewAnnotation
63
+ },
64
+ shape = RoundedCornerShape (16 .dp),
65
+ ) {
66
+ Text (modifier = Modifier .padding(10 .dp), text = " Toggle Visibility" )
67
+ }
68
+ FloatingActionButton (
69
+ modifier = Modifier .padding(bottom = 10 .dp),
70
+ backgroundColor = if (showViewAnnotation) MaterialTheme .colors.secondary else Color .LightGray ,
71
+ onClick = {
72
+ if (showViewAnnotation) {
73
+ allowZElevate = ! allowZElevate
74
+ }
75
+ },
76
+ shape = RoundedCornerShape (16 .dp),
77
+ ) {
78
+ Text (modifier = Modifier .padding(10 .dp), text = " Toggle allowZElevate" )
79
+ }
60
80
}
61
81
}
62
82
) {
@@ -65,6 +85,7 @@ public class ViewAnnotationActivity : ComponentActivity() {
65
85
mapViewportState = rememberMapViewportState {
66
86
setCameraOptions {
67
87
zoom(ZOOM )
88
+ pitch(PITCH )
68
89
center(HELSINKI )
69
90
}
70
91
}
@@ -77,6 +98,7 @@ public class ViewAnnotationActivity : ComponentActivity() {
77
98
anchor(ViewAnnotationAnchor .BOTTOM )
78
99
}
79
100
allowOverlap(false )
101
+ allowZElevate(allowZElevate)
80
102
}
81
103
) {
82
104
Button (
@@ -102,6 +124,7 @@ public class ViewAnnotationActivity : ComponentActivity() {
102
124
}
103
125
104
126
private companion object {
105
- const val ZOOM : Double = 9.0
127
+ const val ZOOM : Double = 16.0
128
+ const val PITCH : Double = 60.0
106
129
}
107
130
}
0 commit comments