MapViewportState

class MapViewportState(initialCameraState: CameraState = INIT_CAMERA_STATE)

A state object that can be hoisted to control and observe the map's camera state. A MapViewportState may only be used by a single MapboxMap composable at a time as it reflects instance state for a single view of a map.

Parameters

initialCameraState

the initial camera position

Constructors

Link copied to clipboard
fun MapViewportState(initialCameraState: CameraState = INIT_CAMERA_STATE)

Types

Link copied to clipboard
object Companion

Companion object of MapViewportState.

Functions

Link copied to clipboard
fun easeTo(cameraOptions: CameraOptions, animationOptions: MapAnimationOptions? = null, completionListener: CompletionListener? = null)

Ease the map camera to a given camera options.

Link copied to clipboard
fun flyTo(cameraOptions: CameraOptions, animationOptions: MapAnimationOptions? = null, completionListener: CompletionListener? = null)

Fly the map camera to a given camera options.

Link copied to clipboard
fun idle()
Link copied to clipboard
fun setCameraOptions(cameraOptions: CameraOptions)

Move the camera instantaneously as specified by cameraOptions. Any camera animation in progress will be cancelled.

fun setCameraOptions(block: CameraOptions.Builder.() -> Unit)

Move the camera instantaneously as specified by block camera options. Any camera animation in progress will be cancelled.

Link copied to clipboard
fun transitionToFollowPuckState(followPuckViewportStateOptions: FollowPuckViewportStateOptions = FollowPuckViewportStateOptions.Builder() .build(), defaultTransitionOptions: DefaultViewportTransitionOptions = DefaultViewportTransitionOptions.Builder() .build(), completionListener: CompletionListener? = null)

Transition to a new FollowPuckViewportState.

Link copied to clipboard
fun transitionToOverviewState(overviewViewportStateOptions: OverviewViewportStateOptions, defaultTransitionOptions: DefaultViewportTransitionOptions = DefaultViewportTransitionOptions.Builder() .build(), completionListener: CompletionListener? = null)

Transition to a new OverviewViewportState.

Properties

Link copied to clipboard
val cameraState: CameraState?

The current CameraState of the map or null if this MapViewportState is not yet associated with a map.

Link copied to clipboard

The current ViewportStatus that represents the status of the viewport or null if this MapViewportState is not yet associated with a map.

Link copied to clipboard

The reason why the ViewportStatus has been changed or null if this MapViewportState is not yet associated with a map.

Link copied to clipboard
val styleDefaultCameraOptions: CameraOptions?

A utility function to get the default CameraOptions defined in the style or null if this MapViewportState is not yet associated with a map.