Use Map.prototype.getOrInsert() in the src/display/annotation_layer.js file

This commit is contained in:
Jonas Jenwald 2026-02-22 17:54:17 +01:00
parent 5bb35eeb35
commit ab8e67ecff

View File

@ -3877,12 +3877,7 @@ class AnnotationLayer {
this.#elements.push(element);
if (data.popupRef) {
const elements = popupToElements.get(data.popupRef);
if (!elements) {
popupToElements.set(data.popupRef, [element]);
} else {
elements.push(element);
}
popupToElements.getOrInsert(data.popupRef, []).push(element);
}
}