Skip to content

Commit

Permalink
Fix compose example app. (#1924)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengdev authored Aug 7, 2023
1 parent 61bb636 commit d861715
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import com.mapbox.geojson.Point
import com.mapbox.maps.*
import com.mapbox.maps.compose.testapp.ExampleScaffold
import com.mapbox.maps.compose.testapp.examples.utils.AnnotationUtils
import com.mapbox.maps.compose.testapp.examples.utils.CityLocations
import com.mapbox.maps.compose.testapp.ui.theme.MapboxMapComposeTheme
import com.mapbox.maps.dsl.cameraOptions
import com.mapbox.maps.extension.compose.MapboxMap
import com.mapbox.maps.extension.compose.animation.viewport.rememberMapViewportState
import com.mapbox.maps.extension.compose.annotation.generated.PolylineAnnotation
import com.mapbox.maps.extension.compose.annotation.generated.PolylineAnnotationGroup
import com.mapbox.maps.plugin.annotation.AnnotationConfig
Expand All @@ -31,8 +34,19 @@ public class PolylineAnnotationActivity : ComponentActivity() {
setContent {
MapboxMapComposeTheme {
ExampleScaffold {
val mapViewportState = rememberMapViewportState {
setCameraOptions(
cameraOptions {
center(CityLocations.NULLISLAND)
zoom(3.0)
pitch(0.0)
bearing(0.0)
}
)
}
MapboxMap(
Modifier.fillMaxSize()
Modifier.fillMaxSize(),
mapViewportState = mapViewportState
) {
PolylineAnnotation(
points = POLYLINE_POINTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ internal object CityLocations {
val BERLIN = Point.fromLngLat(13.403, 52.562)
val KYIV = Point.fromLngLat(30.498, 50.541)
val WASHINGTON = Point.fromLngLat(-77.00897, 38.87031)
val NULLISLAND = Point.fromLngLat(0.0, 0.0)
}

0 comments on commit d861715

Please sign in to comment.