getScreenRect method

Rectangle<int>? getScreenRect(
  1. GemMapController object
)

Returns the screen rectangle occupied by this object in the given map view.

If the object is not currently rendered or the information is not available, the method returns null.

Parameters

  • object: (GemMapController) The map controller for the target map view.

Returns

  • (Rectangle<int>?) The screen rectangle in pixels, or null if not available.

See also:

  • position - Get the object's coordinates.

Implementation

Rectangle<int>? getScreenRect(final GemMapController object) {
  final OperationResult resultString = objectMethod(
    _pointerId,
    'MapSceneObject',
    'getScreenRect',
    args: object.pointerId,
  );

  final int gemApiError = resultString['gemApiError'];

  if (gemApiError != 0) {
    return null;
  }

  final Rectangle<int> rect = Rectangle<int>(
    resultString['result']['x'] ?? 0,
    resultString['result']['y'] ?? 0,
    resultString['result']['width'] ?? 0,
    resultString['result']['height'] ?? 0,
  );

  return rect;
}