centerOnArea method
- RectangleGeographicArea area, {
- int zoomLevel = -1,
- Point<
int> ? screenPosition, - GemAnimation? animation,
Centers the map view on a specified geographic area rectangle.
Positions the map to display the entire RectangleGeographicArea defined by top-left and bottom-right coordinates. The zoom level automatically adjusts to fit the area unless explicitly specified. The area centers at the target screen position or cursor location.
Use centerOnAreaRect for finer control over which screen region displays the area, particularly useful for adding padding or positioning the area within a specific viewport region.
Parameters
area: The geographic area to center on, defined by top-left and bottom-right WGS84 coordinateszoomLevel: Zoom level for the centered view. A greater zoom level means closer to the ground. Use-1for automatic selection to fit the entire area. Defaults to-1screenPosition: Target screen position in physical pixels where the area center should project, relative to the map view's top-left corner. Ifnull, uses the current cursor position. Defaults tonullanimation: Animation settings for the centering operation. Ifnull, centering occurs instantly. Defaults tonull
See also:
- centerOnCoordinates - Center on a single coordinate point
- centerOnAreaRect - Center area within a specific screen rectangle
- transformScreenToWgsRect - Convert screen rectangle to geographic area
Implementation
void centerOnArea(
final RectangleGeographicArea area, {
final int zoomLevel = -1,
final Point<int>? screenPosition,
final GemAnimation? animation,
}) {
objectMethod(
_pointerId,
'MapView',
'centerOnArea',
args: <String, Object?>{
'area': area,
'zoomLevel': zoomLevel,
if (screenPosition != null) 'xy': XyType<int>.fromPoint(screenPosition),
if (animation != null) 'animation': animation,
},
);
}