diff --git a/src/display/annotation_storage.js b/src/display/annotation_storage.js index 2c37d29733edb..f3a4098ba2a87 100644 --- a/src/display/annotation_storage.js +++ b/src/display/annotation_storage.js @@ -142,11 +142,8 @@ class AnnotationStorage { const clone = new Map(); for (const [key, value] of this._storage) { - if (value instanceof AnnotationEditor) { - clone.set(key, value.serialize()); - } else { - clone.set(key, value); - } + const val = value instanceof AnnotationEditor ? value.serialize() : value; + clone.set(key, val); } return clone; } @@ -159,7 +156,8 @@ class AnnotationStorage { const hash = new MurmurHash3_64(); for (const [key, value] of this._storage) { - hash.update(`${key}:${JSON.stringify(value)}`); + const val = value instanceof AnnotationEditor ? value.serialize() : value; + hash.update(`${key}:${JSON.stringify(val)}`); } return hash.hexdigest(); } diff --git a/src/display/editor/freetext.js b/src/display/editor/freetext.js index 9a48172882e30..563327c53be6a 100644 --- a/src/display/editor/freetext.js +++ b/src/display/editor/freetext.js @@ -203,12 +203,12 @@ class FreeTextEditor extends AnnotationEditor { const rect = this.div.getBoundingClientRect(); const [x1, y1] = Util.applyTransform( [this.x, this.y + rect.height], - this.parent.viewport.inverseTransform + this.parent.inverseViewportTransform ); const [x2, y2] = Util.applyTransform( [this.x + rect.width, this.y], - this.parent.viewport.inverseTransform + this.parent.inverseViewportTransform ); return {