FixedAspect

class FixedAspect(val ratio: Float, val minWidth: Float) : CropConstraint(source)

A rectangle whose width over height always equals ratio.

ratio is a fraction of the frame on both axes, not of the frame's own aspect. Build one from a picture ratio with lockedTo, which is where that conversion lives.

A corner drag sets the rectangle's size from its horizontal movement alone, anchored at the opposite corner, so vertical movement on a corner does nothing. An edge drag holds the opposite edge on that same axis fixed and grows the other axis symmetrically around its own centre.

Constructors

Link copied to clipboard
constructor(ratio: Float, minWidth: Float)

Properties

Link copied to clipboard

How narrow the rectangle may get, as a fraction of the frame.

Link copied to clipboard

Width over height the rectangle always keeps, in frame-fraction space.

Functions

Link copied to clipboard
open override fun constrain(proposed: NormalizedRect, handle: CropHandle): NormalizedRect

Corrects proposed into a rectangle this constraint allows.