mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[Annotations] Widget annotations must be in front of the other ones (bug 1883609)
This commit is contained in:
parent
f1272ee435
commit
4e1b96c781
5 changed files with 44 additions and 2 deletions
|
@ -4964,4 +4964,5 @@ export {
|
|||
getQuadPoints,
|
||||
MarkupAnnotation,
|
||||
PopupAnnotation,
|
||||
WidgetAnnotation,
|
||||
};
|
||||
|
|
|
@ -30,7 +30,11 @@ import {
|
|||
Util,
|
||||
warn,
|
||||
} from "../shared/util.js";
|
||||
import { AnnotationFactory, PopupAnnotation } from "./annotation.js";
|
||||
import {
|
||||
AnnotationFactory,
|
||||
PopupAnnotation,
|
||||
WidgetAnnotation,
|
||||
} from "./annotation.js";
|
||||
import {
|
||||
collectActions,
|
||||
getInheritableProperty,
|
||||
|
@ -766,19 +770,26 @@ class Page {
|
|||
}
|
||||
|
||||
const sortedAnnotations = [];
|
||||
let popupAnnotations;
|
||||
let popupAnnotations, widgetAnnotations;
|
||||
// Ensure that PopupAnnotations are handled last, since they depend on
|
||||
// their parent Annotation in the display layer; fixes issue 11362.
|
||||
for (const annotation of await Promise.all(annotationPromises)) {
|
||||
if (!annotation) {
|
||||
continue;
|
||||
}
|
||||
if (annotation instanceof WidgetAnnotation) {
|
||||
(widgetAnnotations ||= []).push(annotation);
|
||||
continue;
|
||||
}
|
||||
if (annotation instanceof PopupAnnotation) {
|
||||
(popupAnnotations ||= []).push(annotation);
|
||||
continue;
|
||||
}
|
||||
sortedAnnotations.push(annotation);
|
||||
}
|
||||
if (widgetAnnotations) {
|
||||
sortedAnnotations.push(...widgetAnnotations);
|
||||
}
|
||||
if (popupAnnotations) {
|
||||
sortedAnnotations.push(...popupAnnotations);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue