centerOnRouteTrafficEvent method
- RouteTrafficEvent routeTrafficEvent, {
- double zoomLevel = -1,
- Rectangle<
int> rectangle = const Rectangle<int>(0, 0, 0, 0), - double? viewAngle,
- GemAnimation? animation,
Centers the map on a traffic event along a route.
Positions the map to focus on a specific traffic event (accident, congestion, road closure, etc.) that affects a route. The zoom level can be automatic or manually specified to provide appropriate detail level.
This is useful for reviewing traffic conditions that may impact navigation or for investigating delays along a route.
Parameters
routeTrafficEvent: The RouteTrafficEvent to center on and displayzoomLevel: Target zoom level. Use-1for automatic selection based on event context. Defaults to-1rectangle: Target screen rectangle in physical pixels where the event should fit, relative to the map view's top-left corner. Defaults toRectangle<int>(0, 0, 0, 0)(uses entire viewport). Useful for fitting within UI elements or adding marginsviewAngle: Camera pitch angle in degrees (0-90), where 0 is top-down view and 90 is horizon view. Ifnull, maintains current pitch. Defaults tonullanimation: Animation settings for the centering operation. Ifnull, centering occurs instantly. Defaults tonull
See also:
- centerOnRoute - Center on an entire route
- centerOnRouteInstruction - Center on a route instruction
Implementation
void centerOnRouteTrafficEvent(
RouteTrafficEvent routeTrafficEvent, {
final double zoomLevel = -1,
final Rectangle<int> rectangle = const Rectangle<int>(0, 0, 0, 0),
final double? viewAngle,
final GemAnimation? animation,
}) {
objectMethod(
_pointerId,
'MapView',
'centerOnRouteTrafficEvent',
args: <String, Object>{
'traffic': routeTrafficEvent.pointerId,
'zoomLevel': zoomLevel,
'rc': RectType<int>.fromRectangle(rectangle),
if (viewAngle != null) 'viewAngle': viewAngle,
if (animation != null) 'animation': animation,
},
);
}