update helper method name, simplify isAnnotatableType method

This commit is contained in:
Jamie V 2025-03-03 13:24:12 -08:00
parent 850c015889
commit 19ee3e532e
2 changed files with 4 additions and 14 deletions

View File

@ -95,7 +95,6 @@ export default class AnnotationAPI extends EventEmitter {
this.availableTags = {};
this.namespaceToSaveAnnotations = '';
this.#targetComparatorMap = new Map();
this.annotatableTypes = [];
this.ANNOTATION_TYPES = ANNOTATION_TYPES;
this.ANNOTATION_TYPE = ANNOTATION_TYPE;
@ -116,17 +115,6 @@ export default class AnnotationAPI extends EventEmitter {
domainObject.annotationType = domainObject.annotationType || 'plotspatial';
}
});
this.openmct.on('start', () => {
const types = this.openmct.types.getTypes();
const typeKeys = Object.keys(types);
typeKeys.forEach((key) => {
if (types[key].definition.annotatable) {
this.annotatableTypes.push(key);
}
});
});
}
/**
* Creates an annotation on a given domain object (e.g., a plot) and a set of targets (e.g., telemetry objects)
@ -601,6 +589,8 @@ export default class AnnotationAPI extends EventEmitter {
* @returns {boolean} Returns true if the type is annotatable
*/
isAnnotatableType(type) {
return this.annotatableTypes.some((annotatableType) => annotatableType === type);
const types = this.openmct.types.getAllTypes();
return types[type]?.definition?.annotatable;
}
}

View File

@ -93,7 +93,7 @@ export default class TypeRegistry {
* List all registered types.
* @returns {Type[]} all registered types
*/
getTypes() {
getAllTypes() {
return this.types;
}
/**