connectedGridCorners

fun connectedGridCorners(index: Int, size: Int, columns: Int): ConnectedCorners

Computes the outer corners for the item at index in a grid-based Connected UI layout.

The grid is filled row-major with columns items per row. A corner is marked as outer only when the item has no neighbor in the two directions that meet at that corner. For example, topStart is outer when there is no item above and no item to the left. The last row may be partially filled; the function accounts for this by checking 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 above it is treated as having a neighbor below. This keeps the junction between the last full row and the stretched final row a seamless joined edge instead of exposing outer corners toward the stretched row.

Return

The ConnectedCorners describing which corners face the exterior.

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.

See also

Throws

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