Nutrient Web SDK

ReferenceAnnotationTooltipCallback

Type Alias AnnotationTooltipCallback

This callback is called whenever an annotation gets selected and can be used to define and return an array of ToolItem that will be rendered in a tooltip for the given annotation.

If the callback returns an empty array then NutrientViewer won't show any tooltip for the selected annotation.

Type Alias
Type Signature
type AnnotationTooltipCallback = (annotation: AnnotationsUnion) => ToolItem[]

Example

Register a AnnotationTooltipCallback handler to show a tooltip for text annotations only.

NutrientViewer.load({
annotationTooltipCallback: function(annotation) {
if (annotation instanceof NutrientViewer.Annotations.TextAnnotation) {
var toolItem = {
type: 'custom',
title: 'tooltip item for text annotations',
id: 'item-text-tooltip-annotation',
className: 'TooltipItem-Text',
onPress: function () {
console.log(annotation)
}
}
return [toolItem]
} else {
return []
}
}
// ...
});

Type Declaration

Parameters

The selected annotation.

Returns

ToolItem[]