Function restrictToBounds

  • Restrict a camera position to be contained within the specified bounds according to its viewport size. If the width of the bounds is smaller than the viewportSize, the center will be returned.

    Parameters

    • input: number

      The value to restrict.

    • min: number

      The minimum value of the bound.

    • max: number

      The maximum value of the bound.

    • viewportSize: number

      The size of the viewport. Min and max will be reduced by half of this value.

    Returns number

    The restricted value.