effect-tree
    Preparing search index...

    Function alignVertically

    • Vertically and horizontally align an array of arrays of single line strings according to the given alignments.

      All columns in the returned array will be as tall as the tallest among them. The given vertical struts will be used to fill the available vertical space: the top and the bottom struts filling each direction respectively.

      The struts will add zero or one strings, from their prefix/body/suffix fields to each line they create for the purpose of alignment. The rest of the line will remain empty, to be filled by the horizontal alignment given in alignOrthogonal.

      For each column we run the given alignOrthogonal function, where you can set horizontal alignment and padding to make sure every row, per column is of the same width.

      If the vertical alignment is center, you can configure the handling of the remainder using the optional useTopRound argument, by default false.

      Remainders pop up when the height of the available space left for padding around the aligned item is odd. By default we add the remainder to the bottom of what we are aligning, so that it will appear above where it should be.

      For example, when aligning a single row part with a a taller part that renders to an even number of rows, we need to decide if we add the remaining space, which is an odd number, above or below what is being aligned.

      The default rounding it to the bottom, meaning the remainder is added to the bottom pushing the aligned text up so it will appear above the center:

      Default useTopRound=false   1 ┌─────────┐
      remainder ┌───────────────┐-2Tall part
      is addedsingle row part3with an
      to shape └───────────────┘-4even
      bottom 5height
      6 └─────────┘

      If you set useTopRound to true, or call the variant of this function alignVertically.useTopRound, the remainder will be added above the shape pushing the shape down so it appears below the center:

      When useTopRound=true       1 ┌─────────┐
      remainder is added 2Tall part
      to shape ┌───────────────┐-3with an
      topsingle row part4even
      └───────────────┘-5height
      6 └─────────┘

      Parameters

      • vStruts: Draw.VStruts

        Top and bottom vertical struts will be used to fill available space.

      • vAlign: "top" | "bottom" | "middle"

        A vertical alignment will be used when not all shapes are of the same height.

      • alignOrthogonal: EndoOf<string[]>

        A function that accepts a list of strings at different widths and returns them at the width of the widest, respecting alignments and struts.

      • useTopRound: boolean = false

        Optional flag determining if remainder is added above or below the shape. By default it is false and the remainder is added below the shape.

      Returns EndoOf<[string[], ...string[][]]>

    Index

    Methods

    Methods