Implements

Constructors

  • Create a FloatRectArray instance. Instead of creating an instance in new mode, use create to create an instance.

    Parameters

    • Optionaloptions: Options

      The options to create a FloatRectArray instance.

    Returns FloatRectArray

     const floatRectArr = await FloatRectArray.create();
    

Properties

options: Options

Methods

  • Add an Rect object to the array.

    Parameters

    • newItem: Rect

      The Rect object to add.

    Returns Promise<number>

    The index of the added element.

    const rect = {
    top: 0,
    right: 100,
    bottom: 100,
    left: 0
    };
    const floatRectArr = await FloatRectArray.create();
    const index = await floatRectArr.add(rect
  • Find the index of the element.

    Parameters

    • rect: Rect

      The element to find.

    • startIndex: number = 0

      The start index to find.

    Returns Promise<number>

  • Get the Rect object at the specified index.

    Parameters

    • index: number

      The index of the element to get.

    Returns Promise<null | Rect>

    Return the Rect object at the specified index.

  • Get the number of elements in the array.

    Returns Promise<number>

    Return the number of elements in the array.

  • Gets the upper bound in the array, actually the maximum valid index.

    Returns Promise<number>

    Return the upper bound in the array.

  • Insert an element.

    Parameters

    • index: number

      The index to insert.

    • newItem: Rect

      The element to insert.

    • count: number

      The number of elements to insert.

    Returns Promise<void>

  • Remove an element by specified index.

    Parameters

    • index: number

      The index of the element to remove.

    • count: number

      The number of elements to remove.

    Returns Promise<void>

  • Set the Rect object at the specified index.

    Parameters

    • index: number

      Set the Rect object at the specified index.

    • newItem: Rect

      The Rect object to set.

    Returns Promise<void>

  • Changes the allocated size and the growing amount.

    Parameters

    • size: number

      The new size in elements expected.

    • growBy: number

      The number of elements to grow by.

    Returns Promise<void>

  • Create a FloatRectArray instance.

    Parameters

    • Optionaloptions: Options

      Create a FloatRectArray instance with the specified options.

    Returns Promise<FloatRectArrayType>

    Return a FloatRectArray instance.

     const floatRectArr = await FloatRectArray.create();