extend method
Creates a new Bounds obtained by expanding the current ones with a new point.
Implementation
Bounds<T> extend(CustomPoint<T> point) {
CustomPoint<T> newMin;
CustomPoint<T> newMax;
// ignore: unnecessary_null_comparison
if (min == null && max == null) {
newMin = point;
newMax = point;
} else {
var minX = math.min(point.x, min.x);
var maxX = math.max(point.x, max.x);
var minY = math.min(point.y, min.y);
var maxY = math.max(point.y, max.y);
newMin = CustomPoint(minX, minY);
newMax = CustomPoint(maxX, maxY);
}
return Bounds._(newMin, newMax);
}