connectedGridEdges

fun connectedGridEdges(index: Int, size: Int, columns: Int): ConnectedEdges

Returns the outline edges for the item at index in a grid-based Connected UI layout.

An edge is suppressed when a neighbor exists on that side: the start edge when there is an item to the left, the end edge when there is an item to the right, the top edge when there is an item above, and the bottom edge when there is an item below. Neighbor checks follow the same rules as connectedGridCorners: they account for actual item existence rather than assuming a full rectangular grid. A partially filled final row is stretched to the full grid width by the Connected grid layouts, so every column of the row directly above it is treated as having a neighbor below.

Return

The ConnectedEdges indicating which sides to outline.

Parameters

index

Zero-based position of the item in row-major order.

size

Total number of items in the grid. Must be greater than zero.

columns

Number of columns in the grid layout. Must be greater than zero.

See also

Throws

if columns is not greater than zero, or if index is outside the range 0 until size.