@lightningjs/renderer
Version:
Lightning 3 Renderer
30 lines (29 loc) • 956 B
TypeScript
import type { CoreNode } from './CoreNode.js';
/**
* Result of autosize calculation containing the new dimensions
*/
interface AutosizeResult {
width: number;
height: number;
hasChanged: boolean;
}
/**
* Creates an autosize manager for efficient child bounds calculation
*
* @remarks
* This function creates a closure-based manager that tracks child transform
* changes and calculates parent dimensions based on children's bounding boxes.
* It's optimized for performance with minimal allocations and fast lookups.
*
* @param parentNode - The autosize parent node
* @returns Object with autosize management methods
*/
export declare function createAutosizeManager(parentNode: CoreNode): {
addOrUpdateChild: (child: CoreNode) => void;
removeChild: (child: CoreNode) => void;
calculateAutosize: () => AutosizeResult;
deactivate: () => void;
readonly active: boolean;
readonly childCount: number;
};
export {};