Search Results for

    Show / Hide Table of Contents

    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
    Object
    IFlexboxLayoutAlgorithm
    ILayoutAlgorithmV4
    ILayoutAlgorithmV4x1
    Implements
    IFlexboxDescribableLayoutAlgorithm,
    Inherited Members
    IFlexboxLayoutAlgorithm.version
    IFlexboxLayoutAlgorithm.defaultAssetName
    Namespace: NinjaTools.FlexBuilder.LayoutAlgorithms
    Assembly: cs.temp.dll.dll
    Syntax
    public abstract class ILayoutAlgorithmV4 : IFlexboxLayoutAlgorithm, IFlexboxDescribableLayoutAlgorithm

    Properties

    - (ReadOnlyCollection<String>) featureDescription

    Methods

    - (T) _GetFirstAncestorComponent(Transform)

    Parameters
    Transform t
    Returns
    T
    Type Parameters
    T

    - (T) _GetHighestAncestorComponent(Transform)

    Parameters
    Transform t
    Returns
    T
    Type Parameters
    T

    - (Boolean) _HasResolvableLengthForAxis(FlexItem, Axis, Nullable)

    Parameters
    FlexItem item
    Axis axis
    Nullable<Single> parentLength
    Returns
    Boolean

    - (Single) _ScaledShrinkFactor(FlexItem, Single, Axis, Nullable)

    Parameters
    FlexItem child
    Single baseLength
    Axis axis
    Nullable<Single> containerInnerSize
    Returns
    Single

    - (void) CalculateAdvances(Int32, FlexContainer, Single, out Single, out Single)

    Parameters
    Int32 numChildItems
    FlexContainer container
    Single unusedMainSpace
    Single preAdvance
    Single postAdvance

    - (Boolean) CanGrowOrShrinkIn(FlexItem, Axis)

    Parameters
    FlexItem element
    Axis axis
    Returns
    Boolean

    - (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
    Single

    - (ContentLength) ConvertBoxLengthToContentLength(FlexItem, BoxLength, Axis, CSSAvailableLength)

    Parameters
    FlexItem item
    BoxLength boxLength
    Axis axis
    CSSAvailableLength parentContainerInnerSize
    Returns
    ContentLength

    - (ContentLength) ConvertBoxLengthToContentLength(FlexItem, Single, Axis, ContentLength)

    Parameters
    FlexItem item
    Single boxLength
    Axis axis
    ContentLength parentContainerInnerSize
    Returns
    ContentLength

    - (ContentLength) ConvertBoxLengthToContentLength(FlexItem, Single, Axis, CSSAvailableSpace)

    Parameters
    FlexItem item
    Single boxLength
    Axis axis
    CSSAvailableSpace parentContainerInnerSize
    Returns
    ContentLength

    - (ContentLength) ConvertBoxLengthToInnerLength(FlexItem, Axis, BoxLength, DefiniteContainingBlockSize)

    If the box-mode is CONTENT_BOX then nothing needs to change; otherwise: fallback toConvertSelfContainingBlockSizeToContentLength(FlexItem, DefiniteContainingBlockSize, Axis)

    Parameters
    FlexItem element
    Axis axis
    BoxLength boxSize
    DefiniteContainingBlockSize elementAsContainingBlockSize
    Returns
    ContentLength
    Exceptions
    Exception

    - (Single) ConvertBoxLengthToOuterLength(FlexItem, Axis, BoxLength, CSSAvailableLength, Boolean)

    Parameters
    FlexItem element
    Axis axis
    BoxLength boxSize
    CSSAvailableLength effectiveContainerInnerLength
    Boolean debug
    Returns
    Single

    - (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
    FlexItem element
    Axis axis
    Single boxSize
    ContentLength effectiveContainerInnerLength
    Boolean debug
    Returns
    Single

    - (Single) ConvertBoxLengthToOuterLength(FlexItem, Axis, Single, CSSAvailableLength, 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
    FlexItem element
    Axis axis
    Single boxSize
    CSSAvailableLength effectiveContainerInnerLength
    Boolean debug
    Returns
    Single

    - (PaddingLength) ConvertBoxLengthToPaddingLength(FlexItem, BoxLength, Axis, CSSAvailableLength)

    Note this converts 'size' to "border-box-size" - with CONTENT_BOX it adds padding, with BORDER_BOX it adds nothing

    Parameters
    FlexItem item
    BoxLength length
    Axis axis
    CSSAvailableLength parentContainerInnerLength
    Returns
    PaddingLength

    - (PaddingLength) ConvertBoxLengthToPaddingLength(FlexItem, BoxLength, Axis, CSSAvailableSpace2)

    Parameters
    FlexItem item
    BoxLength length
    Axis axis
    CSSAvailableSpace2 parentContainerInnerSize
    Returns
    PaddingLength

    - (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
    CSSAvailableLength

    - (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
    Single
    Exceptions
    Exception

    - (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
    FlexItem item
    ContentLength contentLength
    Axis axis
    CSSAvailableLength parentContainerInnerSize
    Returns
    BoxLength
    Exceptions
    Exception

    - (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
    FlexItem item
    ContentLength contentLength
    Axis axis
    Nullable<Single> parentContainerInnerSize
    Returns
    Single

    - (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
    Vector2

    - (Single) ConvertOuterLengthToBorderLength(FlexItem, Single, Axis, CSSAvailableLength)

    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
    FlexItem item
    Single length
    Axis axis
    CSSAvailableLength parentContainerInnerLength
    Returns
    Single

    - (BoxLength) ConvertOuterLengthToBoxLength(FlexItem, Single, Axis, ContentLength)

    Note this converts to 'size', not 'content-size' - content-size would be calc'd identically irrespective of mode!

    ConvertOuterLengthToBorderLength(FlexItem, Single, Axis, CSSAvailableLength)
    Parameters
    FlexItem item
    Single outerLength
    Axis axis
    ContentLength definiteParentInnerLength
    Returns
    BoxLength

    - (BoxLength) ConvertOuterLengthToBoxLength(FlexItem, Single, Axis, CSSAvailableLength)

    Note this converts to 'size', not 'content-size' - content-size would be calc'd identically irrespective of mode!

    ConvertOuterLengthToBorderLength(FlexItem, Single, Axis, CSSAvailableLength)
    Parameters
    FlexItem item
    Single outerLength
    Axis axis
    CSSAvailableLength parentContainerInnerLength
    Returns
    BoxLength

    - (ContentLength) ConvertPaddingLengthToContentLength(FlexItem, PaddingLength, Axis, Func<>>)

    Parameters
    FlexItem item
    PaddingLength paddingLength
    Axis axis
    Func<Nullable<Single>> parentContainerInnerSize
    Returns
    ContentLength

    - (ContentLength) ConvertSelfContainingBlockSizeToContentLength(FlexItem, DefiniteContainingBlockSize, Axis)

    Parameters
    FlexItem item
    DefiniteContainingBlockSize itemAsContainingBlockSize
    Axis axis
    Returns
    ContentLength

    - (void) debugExecutedTimes()

    - (void) executedPhase1OnContainer(FlexContainer)

    Parameters
    FlexContainer fc

    - (void) executedPhase2OnContainer(FlexContainer)

    Parameters
    FlexContainer fc

    - (Boolean) IsDefinite(GameObject, Axis, out Single)

    Parameters
    GameObject objectWithElement
    Axis axis
    Single definiteLength
    Returns
    Boolean

    - (Boolean) IsDefinite(FlexContainer, Axis, out Single)

    Parameters
    FlexContainer element
    Axis axis
    Single definiteLength
    Returns
    Boolean

    - (Boolean) IsDefinite(FlexItem, Axis, out Single)

    Parameters
    FlexItem element
    Axis axis
    Single definiteLength
    Returns
    Boolean

    - (Boolean) IsFullyInflexible(FlexItem)

    Parameters
    FlexItem element
    Returns
    Boolean

    - (Boolean) IsScrollportContainer(FlexContainer)

    Parameters
    FlexContainer fc
    Returns
    Boolean

    - (Double) lastTimePhase1Executed(FlexContainer)

    Parameters
    FlexContainer fc
    Returns
    Double

    - (Double) lastTimePhase2Executed(FlexContainer)

    Parameters
    FlexContainer fc
    Returns
    Double

    - (Single) Legacy_ConvertBoxLengthToInnerLength(FlexItem, Axis, Single)

    Parameters
    FlexItem element
    Axis axis
    Single boxSize
    Returns
    Single

    - (Single) Legacy_ConvertOuterLengthToBoxLength(FlexItem, Single, Axis, CSSAvailableLength)

    Parameters
    FlexItem item
    Single outerLength
    Axis axis
    CSSAvailableLength parentContainerInnerLength
    Returns
    Single

    - (AlignItems) ResolveAlignSelf(FlexItem)

    Parameters
    FlexItem child
    Returns
    AlignItems

    Implements

    IFlexboxDescribableLayoutAlgorithm,
    In This Article
    Back to top http://flexbuilder.ninja