intersect method
Returns the overlap between this area and other.
Implementation
FrameArea intersect(FrameArea other) {
final left = x > other.x ? x : other.x;
final top = y > other.y ? y : other.y;
final clippedRight = right < other.right ? right : other.right;
final clippedBottom = bottom < other.bottom ? bottom : other.bottom;
final clippedWidth = clippedRight - left;
final clippedHeight = clippedBottom - top;
return FrameArea(
left,
top,
clippedWidth > 0 ? clippedWidth : 0,
clippedHeight > 0 ? clippedHeight : 0,
);
}