Adjust a sizer by a delta and update its neighbors accordingly.
The sizers which should be adjusted.
The index of the sizer to grow.
The amount to adjust the sizer, positive or negative.
This will adjust the indicated sizer by the specified amount, along with the sizes of the appropriate neighbors, subject to the limits specified by each of the sizers.
This is useful when implementing box layouts where the boundaries between the sizers are interactively adjustable by the user.
Calculate the optimal layout sizes for a sequence of box sizers.
This distributes the available layout space among the box sizers according to the following algorithm:
Initialize the sizers's size to its size hint and compute the sums for each of size hint, min size, and max size.
If the total size hint equals the available space, return.
If the available space is less than the total min size, set all sizers to their min size and return.
If the available space is greater than the total max size, set all sizers to their max size and return.
If the layout space is less than the total size hint, distribute the negative delta as follows:
a. Shrink each sizer with a stretch factor greater than zero by an amount proportional to the negative space and the sum of stretch factors. If the sizer reaches its min size, remove it and its stretch factor from the computation.
b. If after adjusting all stretch sizers there remains negative space, distribute the space equally among the sizers with a stretch factor of zero. If a sizer reaches its min size, remove it from the computation.
If the layout space is greater than the total size hint, distribute the positive delta as follows:
a. Expand each sizer with a stretch factor greater than zero by an amount proportional to the postive space and the sum of stretch factors. If the sizer reaches its max size, remove it and its stretch factor from the computation.
b. If after adjusting all stretch sizers there remains positive space, distribute the space equally among the sizers with a stretch factor of zero. If a sizer reaches its max size, remove it from the computation.
return
The sizers for a particular layout line.
The available layout space for the sizers.
The delta between the provided available space and the actual consumed space. This value will be zero if the sizers can be adjusted to fit, negative if the available space is too small, and positive if the available space is too large.
The size of each sizer is updated with the computed size.
This function can be called at any time to recompute the layout for an existing sequence of sizers. The previously computed results will have no effect on the new output. It is therefore not necessary to create new sizer objects on each resize event.
Generated using TypeDoc
The namespace for the box engine layout functions.