topCenterRect function
Returns a new Rectangle at the top-center of area with width and height.
Upstream: TopCenterRect in third_party/ultraviolet/layout.go.
Implementation
Rectangle topCenterRect(Rectangle area, int width, int height) {
final centerX = area.minX + area.width ~/ 2;
final minX = centerX - width ~/ 2;
return rect(minX, area.minY, width, height).intersect(area);
}