We are not using webviewer and instead building a custom UI with document/annotation manager. I need to disable the ability for users to command+select multiple annotations in the document when there is more than one. I am using the ‘annotationSelected’ → ‘selected’ event listener and currently selecting the annotation that is in the 0th place. Our UX/UI designer does not want this ability at all. how can I disable?
Hi
Thanks for contacting us for support.
To better assist you, I need more information:
Are you only using the core package instead of our UI?
What version are you using?
Can I know what use case and reason why you want to disable multi selection annotation?
You say that annotationSelected event listener, this is expect behaviour to get the selected annotation. I am still confused that what you want to disable, could you please give me more information about it?/
Best,
Jack
Hi @jhou we would like this ability as well.
Allowing multiple makes the user interface more confusing and our designer has mentioned this to us as well.
I imagine the original request was related to this too. We are building a much more simple PDF viewer than what is in the demos.
Hello,
This could be accomplished through our APIs:
instance.Core.annotationManager.addEventListener('annotationSelected', (annotations)=>{
if(annotations.length > 1) {
annotationManager.deselectAnnotations(annotations.splice(0))
}
})
This deselects all selected annotations except the first in the annotations list when multiple annotations are selected.
Best regards,
Tyler
Suggested solution will work only if multiple annotations were selected with mouse by “drawing” a rectangle around few annotations. length will always be === 1 when multiple annotations selected using command + click or ctrl + click - in this case each event will contain 1 annotation in annotations