centerOnRoutePart method
Centers the map view on a specific segment of a route with automatic zoom.
Positions the map to display a portion of a route defined by start and end distances along the route path. The zoom level automatically adjusts to fit the specified segment within the target screen rectangle.
This is useful for focusing on specific parts of a route, such as upcoming segments during navigation or highlighting problematic sections.
Parameters
route: The Route object containing the segment to displaystartDist: Start distance in meters from the beginning of the routeendDist: End distance in meters from the beginning of the routescreenRect: Target screen rectangle in physical pixels where the route segment should fit, relative to the map view's top-left corner. Ifnull, uses the entire viewport. Defaults tonull. Useful for fitting within UI elements or adding marginsanimation: Animation settings for the centering operation. Ifnull, centering occurs instantly. Defaults tonull
See also:
- centerOnRoute - Center on an entire route
- centerOnRouteInstruction - Center on a specific route instruction
Implementation
void centerOnRoutePart(
final Route route,
final int startDist,
final int endDist, {
final Rectangle<int>? screenRect,
final GemAnimation? animation,
}) {
objectMethod(
_pointerId,
'MapView',
'centerOnRoutePart',
args: <String, dynamic>{
'route': route.pointerId,
'startDist': startDist,
'endDist': endDist,
if (screenRect != null)
'viewRc': RectType<int>.fromRectangle(screenRect),
if (animation != null) 'animation': animation,
},
);
}