transformScreenToWgsRect method

RectangleGeographicArea transformScreenToWgsRect({
  1. Rectangle<int>? screenRect,
})

Converts a screen rectangle to a geographic area.

Transforms a rectangular region in screen coordinates (physical pixels) to its corresponding RectangleGeographicArea defined by WGS84 coordinates. If no rectangle is specified, transforms the entire viewport to geographic coordinates.

The input rectangle is automatically clipped to the viewport bounds. Useful for determining what geographic region is visible in a specific screen area, such as the visible map extent or a custom UI region.

Parameters

  • screenRect: Screen rectangle in physical pixels to convert. If null, uses the entire viewport. The rectangle is clipped against viewport bounds. Defaults to null

Returns

See also:

Implementation

RectangleGeographicArea transformScreenToWgsRect({
  Rectangle<int>? screenRect,
}) {
  screenRect ??= const Rectangle<int>(0, 0, 0, 0);
  final OperationResult resultString = objectMethod(
    _pointerId,
    'MapView',
    'transformScreenToWgsRect',
    args: RectType<int>.fromRectangle(screenRect),
  );

  return RectangleGeographicArea.fromJson(resultString['result']);
}