interface FloatRectArrayType {
    add: (newItem: Rect) => Promise<number>;
    append: (arr: FloatRectArrayType) => Promise<number>;
    copy: (arr: FloatRectArrayType) => Promise<void>;
    destroy: () => Promise<void>;
    find: (rect: Rect, startIndex: number) => Promise<number>;
    getAt: (index: number) => Promise<null | Rect>;
    getSize: () => Promise<number>;
    getUpperBound: () => Promise<number>;
    insertAt: (index: number, newItem: Rect, count: number) => Promise<void>;
    options?: Options;
    removeAll: () => Promise<void>;
    removeAt: (index: number, count: number) => Promise<void>;
    setAt: (index: number, newItem: Rect) => Promise<void>;
    setSize: (size: number, growBy: number) => Promise<void>;
}

Implemented by

Properties

add: (newItem: Rect) => Promise<number>

Add an Rect object to the array.

Type declaration

    • (newItem: Rect): Promise<number>
    • 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
append: (arr: FloatRectArrayType) => Promise<number>

Append an array to the current array.

Type declaration

copy: (arr: FloatRectArrayType) => Promise<void>

Copy from an array.

Type declaration

destroy: () => Promise<void>

Destroy the current object.

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

find: (rect: Rect, startIndex: number) => Promise<number>

Find the index of the element.

Type declaration

    • (rect: Rect, startIndex: number): Promise<number>
    • Parameters

      • rect: Rect

        The element to find.

      • startIndex: number

        The start index to find.

      Returns Promise<number>

getAt: (index: number) => Promise<null | Rect>

Get the Rect object at the specified index.

Type declaration

    • (index: number): Promise<null | Rect>
    • Parameters

      • index: number

        The index of the element to get.

      Returns Promise<null | Rect>

      Return the Rect object at the specified index.

getSize: () => Promise<number>

Get the number of elements in the array.

Type declaration

    • (): Promise<number>
    • Returns Promise<number>

      Return the number of elements in the array.

getUpperBound: () => Promise<number>

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

Type declaration

    • (): Promise<number>
    • Returns Promise<number>

      Return the upper bound in the array.

insertAt: (index: number, newItem: Rect, count: number) => Promise<void>

Insert an element.

Type declaration

    • (index: number, newItem: Rect, count: number): Promise<void>
    • Parameters

      • index: number

        The index to insert.

      • newItem: Rect

        The element to insert.

      • count: number

        The number of elements to insert.

      Returns Promise<void>

options?: Options
removeAll: () => Promise<void>

Remove all elements from the array.

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

removeAt: (index: number, count: number) => Promise<void>

Remove an element by specified index.

Type declaration

    • (index: number, count: number): Promise<void>
    • Parameters

      • index: number

        The index of the element to remove.

      • count: number

        The number of elements to remove.

      Returns Promise<void>

setAt: (index: number, newItem: Rect) => Promise<void>

Set the Rect object at the specified index.

Type declaration

    • (index: number, newItem: Rect): Promise<void>
    • Parameters

      • index: number

        Set the Rect object at the specified index.

      • newItem: Rect

        The Rect object to set.

      Returns Promise<void>

setSize: (size: number, growBy: number) => Promise<void>

Changes the allocated size and the growing amount.

Type declaration

    • (size: number, growBy: number): Promise<void>
    • Parameters

      • size: number

        The new size in elements expected.

      • growBy: number

        The number of elements to grow by.

      Returns Promise<void>