placeIn

fun Box.placeIn(container: Box, anchor: Vector3 = Vector3(0.5, 0.5, 0.5), itemAnchor: Vector3 = anchor): Box(source)

Places this box inside the specified container box using anchor points to determine the relative positioning.

The placement is computed based on the anchor points specified for the container and the item being placed. By default, the anchor points are set to the center of the respective boxes. The dimensions of the placed box remain unchanged.

Return

A new Box representing this box placed inside the container at the calculated position.

Parameters

container

The box that will contain this box.

anchor

The anchor point on the container, defined as a Vector3 where each component ranges from 0.0 to 1.0. The default is the center of the container (0.5, 0.5, 0.5).

itemAnchor

The anchor point on this box, defined as a Vector3 where each component ranges from 0.0 to 1.0. The default is the same as the anchor parameter.


fun Rectangle.placeIn(container: Rectangle, anchor: Vector2 = Vector2(0.5, 0.5), itemAnchor: Vector2 = anchor): Rectangle(source)

Positions the current rectangle (this) within the given container rectangle. The placement is determined by aligning the itemAnchor of the current rectangle to the anchor point within the container rectangle.

Return

A new rectangle representing the current rectangle positioned within the container.

Parameters

container

The rectangle within which the current rectangle will be positioned.

anchor

The relative position of the reference point within the container rectangle. By default, it is set to (0.5, 0.5), which represents the center.

itemAnchor

The relative position of the anchor point within the current rectangle. Defaults to the value of anchor.