@blinkk/degu
    Preparing search index...

    Function calculateBackgroundCover

    • Given two boxes of different aspect ratios, calculates the values in order to make the child cover the parent. This acts similar to background: cover of css.

      Imagine the following:

      -------p--------
      | |
      | ----- |
      | | C | |
      | ----- |
      | |
      -----------------

      This case, c would have to scale up to cover the parent. It would return something like:

      • width: What the child width should be
      • height: What the child height should be
      • xOffset: The Amount to offset x by in order to center.
      • yOffset: The Amount to offset y by in order to center.
      • scalar: The amount to scale

      Note on xOffset and yOffset, this algo assumes that the child will scale from the top left corner of the box and is positioned to the top left.

      Parameters

      Returns backgroundCoverBox

      backgroundCoverBox The dimensions required to transform the child element to background cover.