@itwin/measure-tools-react
Version:
Frontend framework and tools for measurements
37 lines • 1.24 kB
JavaScript
import { IModelApp } from "@itwin/core-frontend";
/** Handles forwarding a cached graphics decorate call for measurements. Note this is package internal and not meant to be exposed as public API. */
export class MeasurementCachedGraphicsHandler {
static get instance() {
if (!this._instance)
this._instance = new MeasurementCachedGraphicsHandler();
return this._instance;
}
get useCachedDecorations() { return true; }
decorate(context) {
if (this._onDecorateCallback)
this._onDecorateCallback(context);
}
setDecorateCallback(callback) {
this._onDecorateCallback = callback;
}
startDecorator() {
if (this._dropCallback)
return;
this._dropCallback = IModelApp.viewManager.addDecorator(this);
}
stopDecorator() {
if (this._dropCallback) {
this._dropCallback();
this._dropCallback = undefined;
}
}
invalidateDecorations(vp) {
if (!vp) {
IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);
}
else {
vp.invalidateCachedDecorations(this);
}
}
}
//# sourceMappingURL=MeasurementCachedGraphicsHandler.js.map