3.0.6 • Published 6 months ago

@types/mapbox__shelf-pack v3.0.6

Weekly downloads
45
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/mapbox__shelf-pack

Summary

This package contains type definitions for @mapbox/shelf-pack (https://github.com/mapbox/shelf-pack).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapbox__shelf-pack.

index.d.ts

// Type definitions for @mapbox/shelf-pack 3.0
// Project: https://github.com/mapbox/shelf-pack
// Definitions by: Gyusun Yeom <https://github.com/Perlmint>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// tslint:disable-next-line no-single-declare-module
declare module "@mapbox/shelf-pack" {
    export = ShelfPack;

    class ShelfPack {
        constructor(width?: number, height?: number, options?: ShelfPack.CreateOption);

        pack(bins: Array<ShelfPack.RequestShort | ShelfPack.RequestLong>, options?: ShelfPack.PackOption): ShelfPack.Bin[];
        packOne(w: number, h: number, id?: ShelfPack.ID): ShelfPack.Bin;
        getBin(id: ShelfPack.ID): ShelfPack.Bin;
        ref(bin: ShelfPack.Bin): number;
        unref(bin: ShelfPack.Bin): number;
        clear(): void;
        resize(w: number, h: number): boolean;

        w: number;
        h: number;
    }

    namespace ShelfPack {
        class Bin {
            constructor(id: ID, x: number, y: number, w: number, h: number, maxw?: number, maxh?: number);

            id: ID;
            x: number;
            y: number;
            w: number;
            h: number;
        }

        type ID = number | string;
        interface Request {
            id?: ID | undefined;
        }
        interface RequestShort extends Request {
            w: number;
            h: number;
        }
        interface RequestLong extends Request {
            width: number;
            height: number;
        }

        interface PackOption {
            /// If true , the supplied bin objects will be updated inplace with x and y properties
            inPlace?: boolean | undefined;
        }

        interface CreateOption {
            /// If true , the sprite will automatically grow
            autoResize?: boolean | undefined;
        }
    }
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 16:23:57 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Gyusun Yeom.

3.0.4

8 months ago

3.0.3

8 months ago

3.0.2

8 months ago

3.0.6

6 months ago

3.0.5

7 months ago

3.0.1

3 years ago

3.0.0

7 years ago