Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 602x 602x 483x 119x 119x | import { Annotation } from '../../../types'; import { isAnnotationLocked } from '../annotationLocking'; import { isAnnotationSelected } from '../annotationSelection'; import { AnnotationStyleStates } from '../../../enums'; /** * Given a Annotation object, return the annotationStyle State that it * should be in based on its data * @param annotation - The annotation that we want to style. * @returns The state of the annotation whether it is Default, Highlighted, Locked, or Selected. */ function getState(annotation?: Annotation): AnnotationStyleStates { Eif (annotation) { if (annotation.data && annotation.highlighted) return AnnotationStyleStates.Highlighted; Eif (isAnnotationSelected(annotation.annotationUID)) return AnnotationStyleStates.Selected; // Todo: make annotation lock api not to rely on the annotation itself if (isAnnotationLocked(annotation)) return AnnotationStyleStates.Locked; } return AnnotationStyleStates.Default; } export default getState; |