mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Change the AnnotationLayer.prototype.getEditableAnnotations method to return an iterator
This method is only used with loops, and it should be a tiny bit more efficient to use an iterator directly rather than first iterating through the underlying `Map` to create a temporary `Array` that we finally iterate through at the call-site.
This commit is contained in:
parent
cc680f68c3
commit
8bbb7c88d3
@ -4100,7 +4100,7 @@ class AnnotationLayer {
|
||||
}
|
||||
|
||||
getEditableAnnotations() {
|
||||
return Array.from(this.#editableAnnotations.values());
|
||||
return this.#editableAnnotations.values();
|
||||
}
|
||||
|
||||
getEditableAnnotation(id) {
|
||||
|
||||
@ -416,8 +416,7 @@ class AnnotationEditorLayer {
|
||||
}
|
||||
|
||||
// Show the annotations that were hidden in enable().
|
||||
const editables = annotationLayer.getEditableAnnotations();
|
||||
for (const editable of editables) {
|
||||
for (const editable of annotationLayer.getEditableAnnotations()) {
|
||||
const { id } = editable.data;
|
||||
if (this.#uiManager.isDeletedAnnotationElement(id)) {
|
||||
editable.updateEdited({ deleted: true });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user