@expofp/floorplan
Version:
Interactive floor plan library for expos and events
32 lines • 1.64 kB
TypeScript
export interface LogoPage<T> {
items: T[];
/** Where the following page starts. */
next: number;
/** Every loaded logo is on this page, so rotating would show the same page again. */
fitsAll: boolean;
/** The page ran past the end of the list. */
wrapped: boolean;
}
/**
* Builds the page of logos that starts at `start`: walks the list once, skips
* logos without a width (not loaded), and keeps as many as fit. Never repeats a
* logo. Keeps one logo even if it is too wide — the caller shrinks it.
* @param all - Every candidate, in rotation order.
* @param start - Index the page starts at.
* @param widthOf - Tile width in pixels, or `undefined` when the logo is not loaded.
* @param maxWidth - The width the row may fill.
* @param spacing - Space around each tile.
* @returns The page and where the following one starts.
*/
export declare function nextLogoPage<T>(all: readonly T[], start: number, widthOf: (item: T) => number | undefined, maxWidth: number, spacing: number): LogoPage<T>;
/**
* Whether to preload the next batch: rotation walks only the attempted prefix,
* so ask for more when the page wrapped, the next page would reach its end, or
* the loaded logos ran out (empty page, or all of them fit and nothing rotates).
* @param page - The page just shown.
* @param attempted - How many leading logos have been through the preloader.
* @param total - How many logos there are.
* @returns True when another batch should load.
*/
export declare function needsMoreLogos(page: LogoPage<unknown>, attempted: number, total: number): boolean;
//# sourceMappingURL=logo-page.d.ts.map