@itwin/core-frontend
Version:
iTwin.js frontend components
45 lines • 2.07 kB
TypeScript
/** @packageDocumentation
* @module Views
*/
import { RenderGraphicOwner } from "./render/RenderGraphic";
import { ViewportDecorator } from "./Viewport";
import { CanvasDecoration } from "./render/CanvasDecoration";
import { GraphicType } from "./common/render/GraphicType";
/** @internal */
export type CachedDecoration = {
type: "graphic";
graphicType: GraphicType;
graphicOwner: RenderGraphicOwner;
} | {
type: "canvas";
canvasDecoration: CanvasDecoration;
atFront: boolean;
} | {
type: "html";
htmlElement: HTMLElement;
};
/** A cache of decorations previously produced by a [[ViewportDecorator]] for which `useCachedDecorations` is `true`.
* The decorations are preserved until either:
* - The associated [[Viewport]]'s scene is invalidated; or
* - The decorator explicitly requests them to be discarded.
* The primary benefit is that cached decorations do not get recreated on every mouse motion.
* @internal
*/
export declare class DecorationsCache {
private readonly _cache;
/** If true, attempts to remove entries from the cache will silently fail. This is set while a [[ScreenViewport]] is producing decorations
* to prevent poorly-written decorators from invalidating the cache while it is being populated by, e.g., calling [[Viewport.invalidateScene]].
*/
prohibitRemoval: boolean;
/** The number of decorators that have entries in the cache. */
get size(): number;
/** Get the list of cached decorations for the decorator. */
get(decorator: ViewportDecorator): CachedDecoration[] | undefined;
/** Add a decoration to the list of cached decorations for the decorator. */
add(decorator: ViewportDecorator, decoration: CachedDecoration): void;
/** Delete the decorator and all of its decorations, disposing of the decorations' graphics. */
delete(decorator: ViewportDecorator): void;
/** Remove all decorators and their decorations from the cache, disposing of the decorations' graphics. */
clear(): void;
}
//# sourceMappingURL=DecorationsCache.d.ts.map