Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 33 additions & 35 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
declare module "potpack" {
export interface PotpackBox {
w: number;
h: number;
/**
* X coordinate in the resulting container.
*/
x?: number;
/**
* Y coordinate in the resulting container.
*/
y?: number;
}

interface PotpackStats {
/**
* Width of the resulting container.
*/
w: number;
/**
* Height of the resulting container.
*/
h: number;
/**
* The space utilization value (0 to 1). Higher is better.
*/
fill: number;
}

export interface PotpackBox {
w: number;
h: number;
/**
* X coordinate in the resulting container.
*/
x?: number;
/**
* Packs 2D rectangles into a near-square container.
*
* Mutates the {@link boxes} array: it's sorted by height,
* and box objects are augmented with `x`, `y` coordinates.
* Y coordinate in the resulting container.
*/
const potpack: (boxes: PotpackBox[]) => PotpackStats;
y?: number;
}

export default potpack;
interface PotpackStats {
/**
* Width of the resulting container.
*/
w: number;
/**
* Height of the resulting container.
*/
h: number;
/**
* The space utilization value (0 to 1). Higher is better.
*/
fill: number;
}

/**
* Packs 2D rectangles into a near-square container.
*
* Mutates the {@link boxes} array: it's sorted by height,
* and box objects are augmented with `x`, `y` coordinates.
*/
declare const potpack: (boxes: PotpackBox[]) => PotpackStats;

export default potpack;