Correctly mimic the proper event-format in AnnotationElement._setDefaultPropertiesFromJS
(bug 1785218)
*This is a follow-up to PR 14869.* In the old code we're accidentally "swallowing" part of the event-details, which explains why the annotationLayer didn't render. One thing that made debugging a lot harder was the lack of error messages, from the viewer, and a few `PDFPageView`-methods were updated to improve this situation.
This commit is contained in:
parent
b05010c3eb
commit
5e126032ff
@ -401,7 +401,13 @@ class AnnotationElement {
|
|||||||
for (const [actionName, detail] of Object.entries(storedData)) {
|
for (const [actionName, detail] of Object.entries(storedData)) {
|
||||||
const action = commonActions[actionName];
|
const action = commonActions[actionName];
|
||||||
if (action) {
|
if (action) {
|
||||||
action({ detail, target: element });
|
const eventProxy = {
|
||||||
|
detail: {
|
||||||
|
[actionName]: detail,
|
||||||
|
},
|
||||||
|
target: element,
|
||||||
|
};
|
||||||
|
action(eventProxy);
|
||||||
// The action has been consumed: no need to keep it.
|
// The action has been consumed: no need to keep it.
|
||||||
delete storedData[actionName];
|
delete storedData[actionName];
|
||||||
}
|
}
|
||||||
|
@ -235,6 +235,7 @@ class PDFPageView {
|
|||||||
try {
|
try {
|
||||||
await this.annotationLayer.render(this.viewport, "display");
|
await this.annotationLayer.render(this.viewport, "display");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
console.error(`_renderAnnotationLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("annotationlayerrendered", {
|
this.eventBus.dispatch("annotationlayerrendered", {
|
||||||
@ -253,6 +254,7 @@ class PDFPageView {
|
|||||||
try {
|
try {
|
||||||
await this.annotationEditorLayer.render(this.viewport, "display");
|
await this.annotationEditorLayer.render(this.viewport, "display");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
console.error(`_renderAnnotationEditorLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("annotationeditorlayerrendered", {
|
this.eventBus.dispatch("annotationeditorlayerrendered", {
|
||||||
@ -274,6 +276,7 @@ class PDFPageView {
|
|||||||
this._buildXfaTextContentItems(result.textDivs);
|
this._buildXfaTextContentItems(result.textDivs);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
console.error(`_renderXfaLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("xfalayerrendered", {
|
this.eventBus.dispatch("xfalayerrendered", {
|
||||||
@ -843,12 +846,10 @@ class PDFPageView {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (this.xfaLayerFactory) {
|
if (this.xfaLayerFactory) {
|
||||||
if (!this.xfaLayer) {
|
this.xfaLayer ||= this.xfaLayerFactory.createXfaLayerBuilder({
|
||||||
this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder({
|
pageDiv: div,
|
||||||
pageDiv: div,
|
pdfPage,
|
||||||
pdfPage,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
this._renderXfaLayer();
|
this._renderXfaLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user