选中和取消选中注释
在 WebViewer 中可以点击注释选中,此时可以使用 annotationManager 获取选中的注释,也可以使用 annotationManager 进行注释的选中和取消选中,这将会在只需要获取选中注释以及需要通过编程方式选中和取消选中注释中非常有用。当注释选中或取消选中时分别会触发 annotationSelected 和 annotationDeselected 事件。
获取选中的注释
当 annotationSelected 事件触发或在有需要时可以通过 annotationManager 获取选中的注释。
javascript
const annotationManager = docViewer.getAnnotationManager()
const selectedAnnotation = annotationManager.getSelectedAnnotation()选中注释
可以通过 annotationManager 中的 selectAnnotation 来选中注释。
javascript
const annotationManager = docViewer.getAnnotationManager()
const annotationsList = annotationManager.getAnnotationsList()
annotationManager.selectAnnotation(annotationsList[0])取消选中注释
可以通过 annotationManager 中的 deSelectAnnotation 来取消选中注释。
javascript
const annotationManager = docViewer.getAnnotationManager()
const selectedAnnotation = annotationManager.getSelectedAnnotation()
annotationManager.deSelectAnnotation(selectedAnnotation)跳转注释
当需要跳转到某个特定注释时,可以通过 jumpToAnnotation 这个 API 跳转到该注释。
javascript
const annotationManager = docViewer.getAnnotationManager()
const annotationsList = annotationManager.getAnnotationsList()
docViewer.jumpToAnnotation(annotationsList[0])