StretchLayoutSolver

public sealed class StretchLayoutSolver
Utility class for solving stretching layouts.

Properties

Count

#
public int Count { get; }
Gets the number of elements defined in this solver.

Indexers

this[]

#
public float this[int index] { get; }
Gets the size of the element at the given index.
index (int)

Methods

Add

#
public void Add(float min, float max, float ideal)
Add an element to this layout. Negative dimensions will be clipped to zero.
min (float)Element minimum size.
max (float)Element maximum size.
ideal (float)Element ideal size.

Round

#
public void Round()
After solving, you may wish to round the layout to pull all the elements to integer coordinates.

Solve

#
public float Solve(float target)
Solve the elements given a fixed target size.
target (float)Target size.
Deviation between computed layout and the target. Negative values indicate the layout is too small, positive values that the layout is too large.