Trapezoid.fromOffsetList constructor
Return the global trapezoid containing the list of Offsets
Implementation
factory Trapezoid.fromOffsetList(List<Offset> offsets) {
double left = double.infinity;
double top = double.infinity;
double right = double.negativeInfinity;
double bottom = double.negativeInfinity;
for (var offset in offsets) {
left = min(left, offset.dx);
top = min(top, offset.dy);
right = max(right, offset.dx);
bottom = max(bottom, offset.dy);
}
return Trapezoid(
topLeftOffset: Offset(left, top),
bottomLeftOffset: Offset(left, bottom),
topRightOffset: Offset(right, top),
bottomRightOffset: Offset(right, bottom),
);
}