ComponentAlignment

enum ComponentAlignment : Enum<ComponentAlignment>

Contains the possible alignment options for a Boundable object relative to other Boundable objects.

Entries

TOP_LEFT
Link copied to clipboard
common
TOP_LEFT(withinFn, { _, _ -> Position.zero() }, aroundFn, { other, target -> other.position.withRelativeX(-target.width) })
TOP_CENTER
Link copied to clipboard
common
TOP_CENTER(withinFn, { other, target -> other.topCenter.withRelativeX(-target.width / 2) }, aroundFn, { other, target -> other.topCenter.withRelativeY(-target.height) .withRelativeX(-target.width / 2) })
TOP_RIGHT
Link copied to clipboard
common
TOP_RIGHT(withinFn, { other, target -> other.topRight.withRelativeX(-target.width) }, aroundFn, { other, _ -> other.topRight })
RIGHT_CENTER
Link copied to clipboard
common
RIGHT_CENTER(withinFn, { other, target -> other.rightCenter.withRelativeX(-target.width) .withRelativeY(-target.height / 2) }, aroundFn, { other, target -> other.rightCenter.withRelativeY(-target.height / 2) })
BOTTOM_RIGHT
Link copied to clipboard
common
BOTTOM_RIGHT(withinFn, { other, target -> other.bottomRight.withRelativeX(-target.width) .withRelativeY(-target.height) }, aroundFn, { other, _ -> other.bottomRight })
BOTTOM_CENTER
Link copied to clipboard
common
BOTTOM_CENTER(withinFn, { other, target -> other.bottomCenter.withRelativeY(-target.height) .withRelativeX(-target.width / 2) }, aroundFn, { other, target -> other.bottomCenter .withRelativeX(-target.width / 2) })
BOTTOM_LEFT
Link copied to clipboard
common
BOTTOM_LEFT(withinFn, { other, target -> other.bottomLeft.withRelativeY(-target.height) }, aroundFn, { other, target -> other.bottomLeft.withRelativeX(-target.width) })
LEFT_CENTER
Link copied to clipboard
common
LEFT_CENTER(withinFn, { other, target -> other.leftCenter.withRelativeY(-target.height / 2) }, aroundFn, { other, target -> other.leftCenter.withRelativeX(-target.width) .withRelativeY(-target.height / 2) })
CENTER
Link copied to clipboard
common
CENTER(withinFn, { other, target -> other.center.withRelativeY(-target.height / 2) .withRelativeX(-target.width / 2) }, aroundFn, { _, _ -> throw UnsupportedOperationException("Can't use CENTER alignment around a container.") })

Functions

alignAround
Link copied to clipboard
common
fun alignAround(other: Rect, target: Size): Position
Returns the Position which can be used to properly align a boundable with target size aroundother.
alignWithin
Link copied to clipboard
common
fun alignWithin(other: Rect, target: Size): Position
Returns the Position which can be used to properly align a boundable with target size withinother.
compareTo
Link copied to clipboard
common
operator override fun compareTo(other: ComponentAlignment): Int
equals
Link copied to clipboard
common
operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
override fun hashCode(): Int
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

name
Link copied to clipboard
common
val name: String
ordinal
Link copied to clipboard
common
val ordinal: Int

Sources

(source)
Link copied to clipboard