Home > @magiclane/maps-sdk > GemView > centerOnAreaRect
GemView.centerOnAreaRect() method
Center a geographic area within the specified screen rectangle.
Positions the map to display the given area inside viewRc, which allows precise control over which portion of the screen shows the area. This is useful for reserving space for overlay UI or adding effective padding around the centered content.
The zoom level is automatically selected to fit the area within the rectangle unless an explicit value is provided.
Signature:
centerOnAreaRect(area: RectangleGeographicArea, options: {
viewRc?: RectType<number> | null;
zoomLevel?: number | -1;
animation?: GemAnimation | null;
}): void;Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
area |
Geographic area to center. | |
|
options |
{ viewRc?: RectType<number> | null; zoomLevel?: number | -1; animation?: GemAnimation | null; } |
Options for centering. |
options properties:
- Optional viewRc?: RectType
| null Screen rectangle in physical pixels where the area should be displayed. The coordinates are relative to the parent view screen.
- Optional zoomLevel?: number | -1
Zoom level. Use `-1` for automatic selection.
- Optional animation?: GemAnimation | null
Specifies the animation to be used by the operation.
Returns:
void
Exceptions
An exception if it fails.