Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
12345678910111213141516171819202122import Foundationimport ParcelConfig
enum ReservedEdgePreviewGeometry { // The four strips partition the reserved area without tinting corners twice. static func strips(in bounds: CGRect, edges: ReservedEdges) -> [CGRect] { precondition(bounds.isFiniteAndPositive) precondition([edges.top, edges.right, edges.bottom, edges.left].allSatisfy { $0.isFinite && $0 >= 0 }) let top = min(edges.top, bounds.height) let bottom = min(edges.bottom, bounds.height - top) let left = min(edges.left, bounds.width) let right = min(edges.right, bounds.width - left) let middleHeight = bounds.height - top - bottom return [ CGRect(x: bounds.minX, y: bounds.maxY - top, width: bounds.width, height: top), CGRect(x: bounds.maxX - right, y: bounds.minY + bottom, width: right, height: middleHeight), CGRect(x: bounds.minX, y: bounds.minY, width: bounds.width, height: bottom), CGRect(x: bounds.minX, y: bounds.minY + bottom, width: left, height: middleHeight), ] }}