fitHorizontally

fun List<Rectangle>.fitHorizontally(within: Rectangle = bounds, gutter: Double = 0.0): List<Rectangle>(source)

Distributes a list of rectangles horizontally within a given container rectangle, maintaining their relative width proportions and adding an optional gutter between them.

Return

A new list of rectangles distributed horizontally within the container rectangle.

Parameters

within

The container rectangle within which the rectangles will be distributed. The default value is the bounding box of the current list of rectangles.

gutter

The space (in units) to be added between adjacent rectangles. Default is 0.0.