ViewportPluginImpl

class ViewportPluginImpl(handler: Handler) : ViewportPlugin

Mapbox default implementation for ViewportPlugin.

The Viewport plugin allows to track objects on a map.

It provides a structured approach to organizing camera management logic into states and transitions between them.

at any given time, the viewport is either:

  • idle (not updating the camera)

  • in a state (camera is being managed by a ViewportState)

  • transitioning (camera is being managed by a ViewportTransition)

Constructors

ViewportPluginImpl
Link copied to clipboard
fun ViewportPluginImpl(handler: Handler = Handler(Looper.getMainLooper()))

Functions

addStatusObserver
Link copied to clipboard
open override fun addStatusObserver(viewportStatusObserver: ViewportStatusObserver)

Adds ViewportStatusObserver to observe the status change.

cleanup
Link copied to clipboard
open override fun cleanup()

Called when the map is destroyed. Should be used to cleanup plugin resources for that map.

idle
Link copied to clipboard
open override fun idle()

Immediately goes to ViewportStatus.Idle state canceling all ongoing transitions.

initialize
Link copied to clipboard
open fun initialize()
makeDefaultViewportTransition
Link copied to clipboard
open override fun makeDefaultViewportTransition(options: DefaultViewportTransitionOptions): DefaultViewportTransition

Create a default ViewportTransition instance with provided DefaultViewportTransitionOptions.

makeFollowPuckViewportState
Link copied to clipboard
open override fun makeFollowPuckViewportState(options: FollowPuckViewportStateOptions): FollowPuckViewportState
makeImmediateViewportTransition
Link copied to clipboard
open override fun makeImmediateViewportTransition(): ViewportTransition

Create a ViewportTransition instance that transition to the target ViewportState immediately.

makeOverviewViewportState
Link copied to clipboard
open override fun makeOverviewViewportState(options: OverviewViewportStateOptions): OverviewViewportState

Create an OverviewViewportState instance with provided OverviewViewportStateOptions.

onDelegateProvider
Link copied to clipboard
open override fun onDelegateProvider(delegateProvider: MapDelegateProvider)

Provides all map delegate instances.

removeStatusObserver
Link copied to clipboard
open override fun removeStatusObserver(viewportStatusObserver: ViewportStatusObserver)
transitionTo
Link copied to clipboard
open override fun transitionTo(targetState: ViewportState, transition: ViewportTransition?, completionListener: CompletionListener?)

Executes a transition to requested state.

Properties

defaultTransition
Link copied to clipboard
open lateinit override var defaultTransition: ViewportTransition

DefaultViewportTransition with default options

options
Link copied to clipboard
open override var options: ViewportOptions

Options that impact the ViewportPlugin.

status
Link copied to clipboard
open override var status: ViewportStatus

Returns current ViewportStatus.