1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

[Editor] Don't create an observer for the stamp annotation after the viewer has been closed

This commit is contained in:
Calixte Denizet 2024-06-20 10:52:28 +02:00
parent 3e1d779859
commit 7d7ae34e34
2 changed files with 20 additions and 12 deletions

View file

@ -538,6 +538,11 @@ class StampEditor extends AnnotationEditor {
* Create the resize observer.
*/
#createObserver() {
if (!this._uiManager._signal) {
// This method is called after the canvas has been created but the canvas
// creation is async, so it's possible that the viewer has been closed.
return;
}
this.#observer = new ResizeObserver(entries => {
const rect = entries[0].contentRect;
if (rect.width && rect.height) {