TrackingCameraBehavior class abstract
Use this class to follow a moving target.
The camera smoothly tracks the target’s position while adjusting heading, tilt, and zoom as needed. When tracking starts or resumes, the camera first animates a re-centering transition to align with the target.
Note: This is a beta release of this feature and may contain bugs or exhibit unexpected behaviour. Related APIs are subject to change without a deprecation process.
- Implemented types
Constructors
- TrackingCameraBehavior()
-
Creates a new instance of this class.
factory
Properties
- bearingInDegrees ↔ double?
-
The camera bearing in degrees.
Optional fixed bearing, from true North (0 degrees) in clockwise direction. The valid range
is [0, 360].
If set, it will prevent the map from rotating to the direction of travel. For example, a
value of zero results in "north up" mode.
Defaults to
null, which means the camera derives the bearing from the Location, so that it points to the direction of travel. If this property isnulland the device does not provide bearing, the last known value is used or zero otherwise. Gets the bearing in degrees.getter/setter pair - cameraTransitionMode ↔ CameraTransitionMode
-
Defines how the camera starts following the current position when this camera
behavior becomes active.
Use CameraTransitionMode.instant to skip the camera animation, for example
when returning from a route overview to guidance.
The default value is CameraTransitionMode.animated.
Gets the currently set camera transition mode.
getter/setter pairinherited
- dynamicAnimationSpeed ↔ TrackingCameraBehaviorDynamicSpeedOptions
-
The time constant for exponential convergence when a policy uses dynamic animation speed.
Controls how quickly tilt and zoom converge to their target values when the
active policy uses dynamic animation speed.
Lowering the time constant results in more dynamic response, while increasing it makes the response slower.
Defaults to 1000 ms.
Gets the dynamic animation speed.
getter/setter pair
- fixedAnimationDuration ↔ Duration
-
The duration of the fixed-duration fast animation in milliseconds.
When TrackingCameraBehavior.flagFixedDurationForNextAnimation is called, the next animation is performed over this duration.
Defaults to 500 milliseconds, or half a second.
Gets the fixed-duration animation duration in milliseconds.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- headingStabilizationThresholdInDegrees ↔ double
-
The heading stabilization threshold in degrees.
Minimum angular change required before the heading signal updates.
Values below this threshold are filtered out to reduce noise and jitter.
Defaults to 5 degrees.
Gets the heading stabilization threshold in degrees.
getter/setter pair
- isManeuverDetectionEnabled ↔ bool
-
Whether maneuver detection is enabled.
When
true, the camera detects adjacent maneuvers and reacts according to the TrackingCameraBehaviorManeuverModeConfiguration set via TrackingCameraBehavior.setManeuverModeConfiguration. A valid TrackingCameraBehaviorManeuverModeConfiguration must be set for the camera to react. Defaults tofalse. Gets whether maneuver detection is enabled.getter/setter pair - maxRotationSpeedInDegreesPerSecond ↔ double
-
The maximum rotation speed.
Maximum bearing rotation speed in degrees per second,
limiting how fast the camera turns. Defaults to 60 degrees per second.
Gets the maximum rotation speed.
getter/setter pair
- normalizedPrincipalPoint ↔ Anchor2D
-
The normalized principal point.
Normalized principal point to be used during navigation.
Defaults to (0.5, 0.775), which means the camera will use the position slightly at the bottom
of the mapview.
Gets the currently set normalized principal point to be used during navigation.
getter/setter pairinherited
- principalPointAnimationDuration ↔ Duration
-
The duration of principal point animation in milliseconds.
If the principal point is changed, the change is animated over this duration.
Defaults to 500 milliseconds, or half a second.
Gets the current principal point animation duration in milliseconds.
getter/setter pair
- recenterAnimationDuration ↔ Duration
-
The duration of recenter animation in milliseconds.
When the camera recenter on the target, the transition is animated over this duration.
Defaults to 500 milliseconds, or half a second.
Gets the recenter animation duration in milliseconds.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tiltInDegrees → double
-
The value of camera tilt in degrees.
Camera tilt angle relative to the ground plane, in degrees.
Defaults to 50.
Gets the camera tilt in degrees.
unless the camera has not yet been attached, in which case the new value
is applied immediately.
no setter
- tiltPolicy ↔ TrackingCameraBehaviorTiltPolicy
-
The strategy of computing the tilt angle.
Defines the strategy used to compute the tilt angle based on scene heuristics.
Defaults to a fixed tilt policy at tilt degrees 45.0.
Gets the current tilt computation strategy.
getter/setter pair
- viewRectangle ↔ Rectangle2D?
-
The view rectangle for camera updates.
Defines a sub-space of the screen that the behavior should consider
for camera updates. Using a view rectangle keeps the camera positioning consistent
across different screen types and orientations without per-screen principal point
adjustments.
Defaults to
null. If not set, it uses the viewport bounds of the underlying map view. Gets the current view rectangle, if it's set.getter/setter pairinherited - zoomMeasureKind → MapMeasureKind
-
The kind of map measure used for zoom representation in the entire configuration.
Determines whether values of zoom in the configuration are interpreted as
MapMeasureKind.zoomLevel or MapMeasureKind.distanceInMeters.
Use TrackingCameraBehavior.setZoomMeasureKind to change. MapMeasureKind.scale is not supported.
Defaults to MapMeasureKind.zoomLevel.
Gets the current zoom measure kind.
no setter
- zoomPolicy ↔ TrackingCameraBehaviorZoomPolicy
-
The strategy of computing the zoom value.
Defines the strategy used to compute the zoom value based on scene heuristics.
Defaults to a fixed zoom policy at zoom value 19.0.
Gets the current zoom computation strategy.
getter/setter pair
- zoomSpeed ↔ double
-
The zoom transition speed in units per second.
Speed controlling how quickly the camera transitions between zoom values.
The unit depends on the configured zoom measure kind: zoom levels per second when using
ZOOM_LEVEL, meters per second when using DISTANCE_IN_METERS.
Defaults to 0.5 (zoom levels per second, matching the default ZOOM_LEVEL kind).
Gets the zoom transition speed.
getter/setter pair
Methods
-
flagFixedDurationForNextAnimation(
) → void - Enables fixed-duration animation mode for the next property change.
-
getManeuverModeConfiguration(
) → TrackingCameraBehaviorManeuverModeConfiguration? -
Gets the current maneuver mode configuration, or
nullif not set. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setManeuverModeConfiguration(
TrackingCameraBehaviorManeuverModeConfiguration? maneuverModeConfiguration) → void - Sets the configuration for camera behavior near maneuvers.
-
setZoomMeasureKind(
MapMeasureKind zoomMeasureKind, double zoomSpeed) → void - Sets the zoom measure kind and the zoom speed simultaneously.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultFunctionalRoadClassZoomPolicyOptions(
) → TrackingCameraBehaviorFunctionalRoadClassZoomPolicyOptions - Returns TrackingCameraBehaviorFunctionalRoadClassZoomPolicyOptions. The default TrackingCameraBehaviorFunctionalRoadClassZoomPolicyOptions.
-
defaultManeuverModeConfiguration(
) → TrackingCameraBehaviorManeuverModeConfiguration - Returns TrackingCameraBehaviorManeuverModeConfiguration. The default TrackingCameraBehaviorManeuverModeConfiguration.
-
defaultSpeedBasedZoomPolicyOptions(
) → TrackingCameraBehaviorSpeedBasedZoomPolicyOptions - Returns TrackingCameraBehaviorSpeedBasedZoomPolicyOptions. The default TrackingCameraBehaviorSpeedBasedZoomPolicyOptions.