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
*/
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.setDimensions();
this.updateMode();

View File

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