Merge pull request #15147 from calixteman/editor_size

[Editor] Avoid to resize and redraw the ink canvas when it's useless
This commit is contained in:
calixteman 2022-07-07 19:49:59 +02:00 committed by GitHub
commit 657edb3892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -578,7 +578,10 @@ class InkEditor extends AnnotationEditor {
this.canvas.style.visibility = "hidden"; this.canvas.style.visibility = "hidden";
if (this.#aspectRatio) { if (
this.#aspectRatio &&
Math.abs(this.#aspectRatio - width / height) > 1e-2
) {
height = Math.ceil(width / this.#aspectRatio); height = Math.ceil(width / this.#aspectRatio);
this.setDims(width, height); this.setDims(width, height);
} }
@ -846,6 +849,9 @@ class InkEditor extends AnnotationEditor {
this.#setCanvasDims(); this.#setCanvasDims();
this.#redraw(); this.#redraw();
this.#realWidth = width;
this.#realHeight = height;
this.setDims(width, height); this.setDims(width, height);
this.translate( this.translate(
prevTranslationX - this.translationX, prevTranslationX - this.translationX,