Skip to content

Commit

Permalink
fix: camera follow demo compass ends follow just like gestures (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
sargunv authored Dec 24, 2024
1 parent 68f33f7 commit 388d259
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,15 @@ fun DemoMapControls(
cameraState: CameraState,
styleState: StyleState,
modifier: Modifier = Modifier,
onCompassClick: () -> Unit = {},
) {
Box(modifier = modifier.fillMaxSize().padding(8.dp)) {
DisappearingScaleBar(cameraState, modifier = Modifier.align(Alignment.TopStart))
DisappearingCompassButton(cameraState, modifier = Modifier.align(Alignment.TopEnd))
DisappearingCompassButton(
cameraState,
modifier = Modifier.align(Alignment.TopEnd),
onClick = onCompassClick,
)
AttributionButton(styleState, modifier = Modifier.align(Alignment.BottomEnd))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ object CameraFollowDemo : Demo {
) {
LocationPuck(locationSource = rememberGeoJsonSource("target", Point(animatedPosition)))
}
DemoMapControls(cameraState, styleState)
DemoMapControls(
cameraState,
styleState,
onCompassClick = {
isFollowing = false
cameraState.position = cameraState.position.copy()
},
)
}

Text(
Expand Down

0 comments on commit 388d259

Please sign in to comment.