getBounds method
Returns a GRect object representing the bounds of this GSprite in the
coordinate space of the targetSpace
object. If the out
parameter is
not null, the result will be stored in that object and returned.
Otherwise, a new GRect object will be created and returned. If this
GSprite has graphics, the bounds will be expanded to include the bounds
of the graphics.
The targetSpace
parameter is the object that defines the coordinate
system to use for the resulting bounds. If it is null, the bounds will be
calculated in the local coordinate space of this GSprite.
The out
parameter is an optional object that will be used to store the
result. If it is not null, the result will be stored in that object and
returned. Otherwise, a new GRect object will be created and returned.
Returns a GRect object representing the bounds of this GSprite in the
coordinate space of the targetSpace
object.
Implementation
@override
GRect? getBounds(GDisplayObject? targetSpace, [GRect? out]) {
out = super.getBounds(targetSpace, out);
if (_graphics != null) {
_sHelperMatrix.identity();
getTransformationMatrix(targetSpace, _sHelperMatrix);
/// single bounds, all paths as 1 rect.
final graphicsBounds = _graphics!.getBounds();
MatrixUtils.getTransformedBoundsRect(
_sHelperMatrix,
graphicsBounds,
graphicsBounds,
);
out!.expandToInclude(graphicsBounds);
}
return out;
}