Merge pull request #15800 from Snuffleupagus/AnnotationEditorLayerBuilder-destroy

[AnnotationEditorLayerBuilder] Inline the `destroy` code in the `cancel` method
This commit is contained in:
Jonas Jenwald 2022-12-10 15:02:43 +01:00 committed by GitHub
commit 879a7432b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 14 deletions

View File

@ -98,7 +98,13 @@ class AnnotationEditorLayerBuilder {
cancel() { cancel() {
this._cancelled = true; this._cancelled = true;
this.destroy();
if (!this.div) {
return;
}
this.pageDiv = null;
this.annotationEditorLayer.destroy();
this.div.remove();
} }
hide() { hide() {
@ -114,15 +120,6 @@ class AnnotationEditorLayerBuilder {
} }
this.div.hidden = false; this.div.hidden = false;
} }
destroy() {
if (!this.div) {
return;
}
this.pageDiv = null;
this.annotationEditorLayer.destroy();
this.div.remove();
}
} }
export { AnnotationEditorLayerBuilder }; export { AnnotationEditorLayerBuilder };

View File

@ -431,18 +431,14 @@ class PDFPageView {
// so they are not displayed on the already resized page. // so they are not displayed on the already resized page.
this.annotationLayer.hide(); this.annotationLayer.hide();
} }
if (annotationEditorLayerNode) { if (annotationEditorLayerNode) {
this.annotationEditorLayer.hide(); this.annotationEditorLayer.hide();
} else {
this.annotationEditorLayer?.destroy();
} }
if (xfaLayerNode) { if (xfaLayerNode) {
// Hide the XFA layer until all elements are resized // Hide the XFA layer until all elements are resized
// so they are not displayed on the already resized page. // so they are not displayed on the already resized page.
this.xfaLayer.hide(); this.xfaLayer.hide();
} }
if (textLayerNode) { if (textLayerNode) {
this.textLayer.hide(); this.textLayer.hide();
} }