useCachedDecorations Readonly
useCachedDecorations: "true" | undefined
Override to enable cached decorations for this decorator.
By default, a decorator is asked to recreate its decorations from scratch via its decorate method whenever the viewport's decorations are invalidated.
Decorations become invalidated for a variety of reasons, including when the scene changes and when the mouse moves.
Most decorators care only about when the scene changes, and may create decorations that are too expensive to recreate on every mouse motion.
If useCachedDecorations
is true, then the viewport will cache the most-recently-created decorations for this decorator, and only invoke its decorate method if it has no cached decorations for it.
The cached decorations are discarded:
- Whenever the scene changes; and
- When the decorator explicitly requests it via invalidateCachedDecorations or invalidateCachedDecorationsAllViews. The decorator should invoke the latter when the criteria governing its decorations change.
Defined in
- core/frontend/src/Viewport.ts Line 85
Last Updated: 21 November, 2024