Class ILayoutAlgorithmV4
There are three phases to flex-layout in the v4 Algorithms, based on decomposing the Flexbox system and carefully
looking at which bits can be shared, which can be re-used, which can be cached - and which must not.
For any non-FlexContainer: none of this applies: it calculates (but does not itself use) a default size (or none), and is later force-sized by its parent.
For any definite FlexContainer: NB: 'definite' has magic-meaning in CSS3 -- halfway between the non-FlexContainers and the FlexContainers
For all other FlexContainers:
Layout-self:
If you already know your size:
if it's different from your current size:
Phase 1: Calculate all children-sizes, and 'virtually' lay them out internally into Flex-lines, using grow/shrunk, but NOT overwriting any values
Phase 3: set size of all children, and position all children
if it's the same as your current size:
Phase 0: do nothing
If you don't know your size yet, called by something else:
Phase 1: Calculate all children-sizes, and 'virtually' lay them out internally into Flex-lines, returning the result, and wait
If you don't know your size yet, called by yourself:
Phase 1: Calculate all children-sizes, and 'virtually' lay them out internally into Flex-lines
Phase 2: Set size of self, using the child-sizes + flex-lines from phase 1
Phase 3: set size of all children, and position all children
Notes:
- Phase3 requires that you ALREADY HAVE SET YOUR FINAL SIZE (because positioning requires knowing the correct, final, self-size)
- Phase1 MUST NOT change any sizes/positions/etc (because sometimes it's purely information-gathering)
- Phase2 only happens if you are self-sizing AND your basis is a variation of CONTENT (e.g. CONTENT or AUTO-but-no-width/height)
Inheritance
ILayoutAlgorithmV4
Assembly: cs.temp.dll.dll
public abstract class ILayoutAlgorithmV4 : IFlexboxLayoutAlgorithm, IFlexboxDescribableLayoutAlgorithm
Properties
Methods
Parameters
Returns
Type Parameters
Parameters
Returns
Type Parameters
- (Single)
ConvertBoxLengthToBorderLength(FlexItem, Single, Axis, ContentLength)
Note this converts 'size' to "border-box-size" - with CONTENT_BOX it adds padding, with BORDER_BOX it adds nothing
Parameters
FlexItem |
item |
|
Single |
length |
|
Axis |
axis |
|
ContentLength |
parentContainerInnerLength |
|
Returns
- (ContentLength)
ConvertBoxLengthToContentLength(FlexItem, BoxLength, Axis, CSSAvailableLength)
- (ContentLength)
ConvertBoxLengthToContentLength(FlexItem, Single, Axis, ContentLength)
Parameters
FlexItem |
item |
|
Single |
boxLength |
|
Axis |
axis |
|
ContentLength |
parentContainerInnerSize |
|
Returns
- (ContentLength)
ConvertBoxLengthToContentLength(FlexItem, Single, Axis, CSSAvailableSpace)
Parameters
Returns
Exceptions
- (Single)
ConvertBoxLengthToOuterLength(FlexItem, Axis, Single, ContentLength, Boolean)
Spec: https://www.w3.org/TR/css-sizing-3/#outer-size
Outer Size === "content_box + padding + border + margins" -- i.e. the outermost variant of a CSS Box
Note: Requires that the size passed in is the 'box' size, which depends on the element's boxmode (CONTENT_BOX
vs BORDER_BOX etc)
Parameters
Returns
Spec: https://www.w3.org/TR/css-sizing-3/#outer-size
Outer Size === "content_box + padding + border + margins" -- i.e. the outermost variant of a CSS Box
Note: Requires that the size passed in is the 'box' size, which depends on the element's boxmode (CONTENT_BOX
vs BORDER_BOX etc)
Parameters
Returns
Note this converts 'size' to "border-box-size" - with CONTENT_BOX it adds padding, with BORDER_BOX it adds nothing
Parameters
Returns
- (CSSAvailableLength)
ConvertContentLengthToAvailableLength(ContentLength)
The conversion doesn't add or subtract anything, but helps us to be explicit about the type-conversion we're
trying to do in calling code
Parameters
ContentLength |
innerLengthInParent |
|
Returns
- (Single)
ConvertContentLengthToBoxLength(FlexItem, ContentLength, Axis, ContentLength)
NOTE: According to the CSS2 Spec, for all cases where the parent size is needed for %age calculations on padding/margins
and the parent-size is not yet known (only happens because parent's size is CONTENT/depends on child), then
the padding/margins are converted into "0": https://www.w3.org/TR/css-sizing-3/#cyclic-percentage-contribution
Parameters
FlexItem |
item |
|
ContentLength |
contentLength |
|
Axis |
axis |
|
ContentLength |
parentContainerInnerSize |
|
Returns
Exceptions
- (BoxLength)
ConvertContentLengthToBoxLength(FlexItem, ContentLength, Axis, CSSAvailableLength)
NOTE: According to the CSS2 Spec, for all cases where the parent size is needed for %age calculations on padding/margins
and the parent-size is not yet known (only happens because parent's size is CONTENT/depends on child), then
the padding/margins are converted into "0": https://www.w3.org/TR/css-sizing-3/#cyclic-percentage-contribution
Parameters
Returns
Exceptions
- (Single)
ConvertContentLengthToBoxLength(FlexItem, ContentLength, Axis, Nullable)
Note this converts to 'size', not 'outer-size' - with CONTENT_BOX it adds nothing, with BORDER_BOX it adds the padding + border-width
Parameters
Returns
- (Vector2)
ConvertContentSizeToBoxSize(FlexItem, Vector2, Vector2)
Note this converts to 'size', not 'outer-size' - with CONTENT_BOX it adds nothing, with BORDER_BOX it adds the padding + border-width
Parameters
FlexItem |
item |
|
Vector2 |
contentSize |
|
Vector2 |
parentContainerInnerSize |
|
Returns
When you start with an 'outer' length -- e.g. 'stretch to fit my parent', where the size you have is the parents
inner size, which must be used as the initial value of the child's outer size ... but you need to turn that outer
size into a content size, border size, box size, etc ... this converts it into the most common one: border size.
ConvertOuterLengthToBoxLength(FlexItem, Single, Axis, CSSAvailableLength)
Parameters
Returns
- (BoxLength)
ConvertOuterLengthToBoxLength(FlexItem, Single, Axis, ContentLength)
Parameters
FlexItem |
item |
|
Single |
outerLength |
|
Axis |
axis |
|
ContentLength |
definiteParentInnerLength |
|
Returns
- (ContentLength)
ConvertPaddingLengthToContentLength(FlexItem, PaddingLength, Axis, Func<>>)
- (ContentLength)
ConvertSelfContainingBlockSizeToContentLength(FlexItem, DefiniteContainingBlockSize, Axis)
Parameters
GameObject |
objectWithElement |
|
Axis |
axis |
|
Single |
definiteLength |
|
Returns
Implements