Merge pull request #15583 from calixteman/15582

[Editor] Commit the current editor before setting the new viewport
This commit is contained in:
calixteman 2022-10-17 12:56:21 +02:00 committed by GitHub
commit 9355b72931
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -561,6 +561,11 @@ class AnnotationEditorLayer {
* @param {Object} parameters * @param {Object} parameters
*/ */
update(parameters) { update(parameters) {
// Editors have their dimensions/positions in percent so to avoid any
// issues (see #15582), we must commit the current one before changing
// the viewport.
this.#uiManager.commitOrRemove();
this.viewport = parameters.viewport; this.viewport = parameters.viewport;
this.setDimensions(); this.setDimensions();
this.updateMode(); this.updateMode();

View File

@ -941,11 +941,7 @@ class AnnotationEditorUIManager {
* Delete the current editor or all. * Delete the current editor or all.
*/ */
delete() { delete() {
if (this.#activeEditor) { this.commitOrRemove();
// An editor is being edited so just commit it.
this.#activeEditor.commitOrRemove();
}
if (!this.hasSelection) { if (!this.hasSelection) {
return; return;
} }
@ -965,6 +961,11 @@ class AnnotationEditorUIManager {
this.addCommands({ cmd, undo, mustExec: true }); this.addCommands({ cmd, undo, mustExec: true });
} }
commitOrRemove() {
// An editor is being edited so just commit it.
this.#activeEditor?.commitOrRemove();
}
/** /**
* Select the editors. * Select the editors.
* @param {Array<AnnotationEditor>} editors * @param {Array<AnnotationEditor>} editors