getBounds method
Returns the bounding box of the graphics object.
If out
is provided, it sets the bounding box values to the given
GRect and returns it. Otherwise, it creates a new GRect.
Implementation
@override
GRect getBounds([GRect? out]) {
Rect? r;
for (var e in _drawingQueue) {
final pathRect = e?.path?.getBounds();
if (pathRect == null) {
break;
}
if (r == null) {
r = pathRect;
} else {
r = r.expandToInclude(pathRect);
}
}
final result = r ?? Rect.zero;
if (out == null) {
out = GRect.fromNative(result);
} else {
out.setTo(result.left, result.top, result.width, result.height);
}
return out;
}