import { DeepImmutable } from './loader/babylonjs-import';
/**
 * Cached information from a `DOMRect`.
 */
export interface DOMRectCached extends DeepImmutable<DOMRect> {
    /** Same as `HTMLElement.scrollLeft` */
    readonly scrollLeft: number;
    /** Same as `HTMLElement.scrollTop` */
    readonly scrollTop: number;
    /**
     * Last time, in ms, {@link refresh} was called.
     */
    readonly lastRefreshInMs: number;
    readonly document: {
        readonly scrollLeft: number;
        readonly scrollTop: number;
    };
    /**
     * Refreshes cached client rect information (by calling wrapped `HTMElement.getBoundingClientRect()`).
     * Updates {@link lastRefreshInMs} when called.
     */
    refresh(): void;
}
/**
 * Cache for bounding client rectangles. This is useful when cost of `HTMLElement.getBoundingClientRect()`
 * becomes a problem (it causes browser reflow which in some situations can be very costly). By caching
 * the information from the `DOMRect`, this cost can be avoided.
 */
export declare class BoundingClientRectCache {
    private readonly _map;
    /**
     * Get or add a {@link DOMRectCached} instance for a specified `element`.
     * @param element HTMLElement to get a {@link DOMRectCached} instance for.
     * @param timeInMsToNextRefresh Optional. Defaults to 300. If the instance, returned by this method, already exists
     * in the cache. Then {@link DOMRectCached.refresh} method on the instance is called automatically if
     *
     * 1. `timeInMsToNextRefresh = 0`. Useful when {@link DOMRectCached} should be refreshed immediatly.
     * 2. `timeInMsToNextRefresh > 0 && performance.now() - instance.lastRefreshInMs > timeInMsToNextRefresh`
     *
     * This means that if `timeInMsToNextRefresh < 0` then {@link DOMRectCached.refresh} will never be called. This can be useful
     * when we never want to refresh the {@link DOMRectCached} instance.
     * @returns A {@link DOMRectCached} element.
     */
    getOrAdd(element: HTMLElement, timeInMsToNextRefresh?: number): DOMRectCached;
}
/**
 * Predefined cache for bounding client rectangles. This is useful when cost of `HTMLElement.getBoundingClientRect()`
 * becomes a problem (it causes browser reflow which in some situations can be very costly.). By caching
 * the information we get from the `DOMRect` we can avoid this cost.
 */
export declare const boundingClientRectCache: BoundingClientRectCache;
//# sourceMappingURL=BoundingClientRectCache.d.ts.map