Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • Returns a rectangle where the longest length of rect will be equal to the shortest length of to. The shortest length of rect will be proportionally scaled to match the aspect ratio of rect. The returned rectangle will be centered within to.

    see

    cropFit

    Parameters

    Returns Rectangle

  • create(x: number, y: number, width: number, height: number): Rectangle
  • Parses a JSON string representation of a Rectangle and returns an object.

    Parameters

    • json: string

      A JSON string, either in the form [x,y,width,height] or {"x": 0, "y": 0, "width": 10, "height": 10}

    Returns Rectangle

    A parsed Point.

  • Returns a rectangle where the position and dimensions are scaled by the given factors. If scaleY is omitted, then the position and dimensions are scaled uniformly by scaleOrScaleX.

    Parameters

    • rect: Rectangle

      The rectangle to scale.

    • scaleOrScaleX: number

      The uniform scale factor, or the horizontal scale factor.

    • Optional scaleY: number

      The vertical scale factor.

    Returns Rectangle

    A scaled rectangle.

  • Returns a rectangle where each side of rect will be reduced proportionally to have an area less than or equal to the provided to value. The returned rectangle will be centered within the original bounds of rect.

    Parameters

    • to: number

      the maximum area this rectangle can have

    • rect: Rectangle

      the rectangle to scale to fit the specified area

    Returns Rectangle