adjacent

fun Rectangle.adjacent(left: Double? = null, right: Double? = null, top: Double? = null, bottom: Double? = null, width: Double? = null, height: Double? = null): Rectangle(source)

Adjusts the dimensions and position of the rectangle based on the provided parameters. The method calculates the new dimensions and coordinates of the rectangle based on specified values for left, right, top, bottom, width, or height. If conflicting parameters are provided (e.g., both left and right or top and bottom), an error is thrown.

Return

A new Rectangle with the adjusted dimensions and position.

Parameters

left

Optional offset to adjust the left side of the rectangle. If provided along with right, an error is thrown.

right

Optional offset to adjust the right side of the rectangle. If provided along with left, an error is thrown.

top

Optional offset to adjust the top side of the rectangle. If provided along with bottom, an error is thrown.

bottom

Optional offset to adjust the bottom side of the rectangle. If provided along with top, an error is thrown.

width

Optional value to override the width of the rectangle. Ignored if both left and right are provided.

height

Optional value to override the height of the rectangle. Ignored if both top and bottom are provided.