Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? Yes
Please give a brief summary of your issue:
Determine what annotations are shown based on filter setting
Please describe your issue and provide steps to reproduce it:
Good day. We want to know if there is a way to get the annotations via the annotationsManager that are allowed to appear according to the filter settings:
In the example above, I need to get a reference to that 1 blue annotation via the annotationsManager because it is the only one appearing in the Comments panel as of this time.
I tried looking at the Listable property of an annotation but it never changes whenever the filter settings change. The annotationFilterChanged event only gives me what filter settings are (Also want to note that this event does not tell me if “Filter document and comments panel” is checked or not) applied.
We are avoiding crawling the HTML generated under the comments panel because of 2 reasons: 1) Performance: We tried this approach for a different requirement before and it revealed it was slowing down the viewer as a whole when there are 200+ annotations. 2) If the comments’ panel virtual scrolling is enabled, it will only render max 100 annotations in the DOM therefore will give an inaccurate count of filtered annotations to process if we rely on this
Thank you!
Please provide a link to a minimal sample where the issue is reproducible:
N/A
We don’t have an API that can retrieve the annotation based on the filter settings on the notesPanel.
We can add this as a feature request,
If you could provide some further information around the context of why you want the feature, this may help prioritize its development. We would be interested to know:
What is the workflow that you would use the requested feature in?
Why is the feature valuable to you and your users?
We are adding our own feature called Show / Hide annotations where it is a custom button added at the top header and its purpose is to Show or Hide all annotations drawn on the canvas. The comments list should be unaffected by its function
To achieve this, we made use of the NoView property of each annotation and set it to false:
private setAnnotationsNoView(
annotationManager: Core.AnnotationManager,
annotations: Core.Annotations.Annotation[],
hideAnnotations: boolean
) {
annotations.forEach((annotation) => {
annotation.NoView = hideAnnotations;
});
annotationManager.drawAnnotationsFromList(annotations);
//Run this now because setting the NoView property will cause these annotations to be part of the next export where it sets the noview flag
annotationManager.exportAnnotationCommand();
}
However, once the Filter comes into play, it can produce some unexpected results. For example, when the “Filter document and comments panel” is ticked in the Filter dialog, it also makes use of the NoView property to achieve its desired effect. So the use case of 1) Hide All Annotations then 2) Configure your filter, ensure to tick that checkbox mentioned above then 3) Show All Annotations results in the annotations that the current Filter is supposed to be hiding fron canvas to reappear again
Also as a follow up while we are coming up with ways to mitigate the specific issue, I would also like to ask if there’s also a programmatic way to clear the Filter. We will fall back into this approach and execute said function whenever our Show / Hide Annotations button is clicked
We don’t have a programmatic way to clear the filters on the notesPanel, but this can be added as a feature request to the backlog for the product team to review and prioritize.
As for the code snippet above, you can take advantage of hide/showAnnotations API to clear them from the canvas similar to this forum post:
I have submitted this feature request for the product team to review.
While not all feature requests get completed. If they do, they will be available in our change-logs and announcements: