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

Merge pull request #18171 from Snuffleupagus/move-pendingTextLayers

Don't register a pending `TextLayer` until `render` is invoked (PR 18104 follow-up)
This commit is contained in:
Tim van der Meij 2024-05-28 15:37:51 +02:00 committed by GitHub
commit ee545930ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -122,7 +122,6 @@ class TextLayer {
setLayerDimensions(container, viewport);
TextLayer.#pendingTextLayers.add(this);
// Always clean-up the temporary canvas once rendering is no longer pending.
this.#capability.promise
.catch(() => {
@ -167,6 +166,7 @@ class TextLayer {
}, this.#capability.reject);
};
this.#reader = this.#textContentSource.getReader();
TextLayer.#pendingTextLayers.add(this);
pump();
return this.#capability.promise;
@ -423,6 +423,7 @@ class TextLayer {
return;
}
this.#ascentCache.clear();
for (const { canvas } of this.#canvasContexts.values()) {
canvas.remove();
}