alignToHorizontally

fun List<Rectangle>.alignToHorizontally(to: Rectangle, anchor: Double = 0.5): List<Rectangle>(source)

Aligns a list of rectangles horizontally relative to a specified rectangle.

Each rectangle in the list is repositioned so that its horizontal alignment matches the specified anchor point of the target rectangle.

Return

A new list of rectangles aligned horizontally relative to the target rectangle.

Parameters

to

The target rectangle to align to.

anchor

A value between 0.0 and 1.0 representing the horizontal position within the target rectangle. Default is 0.5 (center).