leftCenterRect function

Rectangle leftCenterRect(
  1. Rectangle area,
  2. int width,
  3. int height
)

Returns a new Rectangle at the left-center of area with width and height.

Upstream: LeftCenterRect in third_party/ultraviolet/layout.go.

Implementation

Rectangle leftCenterRect(Rectangle area, int width, int height) {
  final centerY = area.minY + area.height ~/ 2;
  final minY = centerY - height ~/ 2;
  return rect(area.minX, minY, width, height).intersect(area);
}