Merge pull request #14993 from Snuffleupagus/editor-AnnotationStorage-hash
[editor] Update the `AnnotationStorage.hash`-getter to support editing
This commit is contained in:
commit
1816b5e926
@ -142,11 +142,8 @@ class AnnotationStorage {
|
|||||||
|
|
||||||
const clone = new Map();
|
const clone = new Map();
|
||||||
for (const [key, value] of this._storage) {
|
for (const [key, value] of this._storage) {
|
||||||
if (value instanceof AnnotationEditor) {
|
const val = value instanceof AnnotationEditor ? value.serialize() : value;
|
||||||
clone.set(key, value.serialize());
|
clone.set(key, val);
|
||||||
} else {
|
|
||||||
clone.set(key, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
@ -159,7 +156,8 @@ class AnnotationStorage {
|
|||||||
const hash = new MurmurHash3_64();
|
const hash = new MurmurHash3_64();
|
||||||
|
|
||||||
for (const [key, value] of this._storage) {
|
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();
|
return hash.hexdigest();
|
||||||
}
|
}
|
||||||
|
@ -203,12 +203,12 @@ class FreeTextEditor extends AnnotationEditor {
|
|||||||
const rect = this.div.getBoundingClientRect();
|
const rect = this.div.getBoundingClientRect();
|
||||||
const [x1, y1] = Util.applyTransform(
|
const [x1, y1] = Util.applyTransform(
|
||||||
[this.x, this.y + rect.height],
|
[this.x, this.y + rect.height],
|
||||||
this.parent.viewport.inverseTransform
|
this.parent.inverseViewportTransform
|
||||||
);
|
);
|
||||||
|
|
||||||
const [x2, y2] = Util.applyTransform(
|
const [x2, y2] = Util.applyTransform(
|
||||||
[this.x + rect.width, this.y],
|
[this.x + rect.width, this.y],
|
||||||
this.parent.viewport.inverseTransform
|
this.parent.inverseViewportTransform
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user