getBounds method

  1. @override
GRect getBounds(
  1. GDisplayObject? targetSpace, [
  2. GRect? out
])
override

Returns the axis-aligned bounding rectangle of the object relative to the targetSpace object. If targetSpace is null, the bounds will be relative to this object's parent.

An optional out parameter can be provided to avoid creating a new GRect instance on every call.

The method applies a matrix transformation to the bounds of the object to align it with the new coordinate space. If you pass a non-null targetSpace matrix, the method automatically multiplies the object's matrix transform by the matrix of the target coordinate space.

If targetSpace is not an ancestor of this object or if it is null, returns the bounds in this object's local coordinate space.

Implementation

@override
GRect getBounds(GDisplayObject? targetSpace, [GRect? out]) {
  _sHelperMatrix.identity();
  getTransformationMatrix(targetSpace, _sHelperMatrix);
  return MatrixUtils.getTransformedBoundsRect(
    _sHelperMatrix,
    _localBounds,
    out,
  );
}