Could you please provide more information about this use case?
To begin helping you below is a code of how you can listen to the event of changing the toolbar group. This will return which Toolbar group the user had chosen. I also added the code of how to get the list of annotations.
WebViewer({
...options
}).then(instance => {
...
const { annotationManager } = instance.Core;
const UIEvents = instance.UI.Events;
instance.UI.addEventListener(UIEvents.TOOLBAR_GROUP_CHANGED, e => {
const currentToolbarGroup = e.detail;
// Toolbar group choosed
console.log(currentToolbarGroup);
// Annotations list in the moment of the toolbar group change
const annotationsList = annotationManager.getAnnotationsList();
console.log(annotationsList);
});
})
You can use the hideAnnotations API to hide a list of annotations.