logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class FlexboxSolver

    Pure flexbox main-axis solver. Given the container's main-axis length, the gap between children, and each child's LayoutSize, it returns each child's resolved main-axis length. Absolute children (FIXED px, PERCENT of the axis) claim their size first; FLEX/AUTO children share the remaining space by weight (AUTO ≈ one flex share). When there are no flex children and the absolute sizes overflow the axis, they are scaled down proportionally to fit.

    Inheritance
    object
    FlexboxSolver
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Ui.Domain.Services
    Assembly: Serenity.Ui.Domain.dll
    Syntax
    public static class FlexboxSolver
    Remarks

    Engine-free (no Unity types) so it is the single source of truth shared by the builder wireframe and the UI preview — and any other caller — instead of each re-deriving the same arithmetic.

    Methods

    Solve(float, float, IReadOnlyList<LayoutSize>, float)

    Resolves the main-axis length of each child along a single flex axis.

    Declaration
    public static float[] Solve(float available, float gap, IReadOnlyList<LayoutSize> sizes, float pxScale = 1)
    Parameters
    Type Name Description
    float available

    The container's main-axis length, before subtracting gaps.

    float gap

    The gap between adjacent children.

    IReadOnlyList<LayoutSize> sizes

    Each child's size policy, in layout order.

    float pxScale

    Scale applied to FIXED px values: 1 for literal pixels, or <1 to map true pixels onto a smaller preview canvas. Does not affect PERCENT/FLEX/AUTO.

    Returns
    Type Description
    float[]

    An array of resolved main-axis lengths, one per child (empty when sizes is empty).

    In this article
    © 2026 Serenity. All Rights Reserved