Added confirmation window prior to document resize to indicate it is permanent

This commit is contained in:
Igor Zinken
2021-01-31 16:37:43 +01:00
parent 5c9ce5c919
commit 929754db96
2 changed files with 23 additions and 11 deletions

View File

@@ -2,6 +2,8 @@
"en-US": {
"resizeDocument": "Resize document",
"maintainAspectRatio": "Maintain aspect ratio",
"areYouSure": "Are you sure?",
"resizeIsPermanent": "Resizing a document is permanent and cannot be undone.",
"save": "Save",
"cancel": "Cancel"
}

View File

@@ -116,21 +116,31 @@ export default {
"closeModal",
"setActiveDocumentSize",
"resizeActiveDocumentContent",
"openDialog",
"resetHistory"
]),
lockSync() {
async lockSync() {
this.syncLock = true;
this.$nextTick(() => {
this.syncLock = false;
});
await this.$nextTick();
this.syncLock = false;
},
async save() {
const { width, height } = this.dimensions;
const scaleX = width / this.activeDocument.width;
const scaleY = height / this.activeDocument.height;
save() {
this.openDialog({
type: "confirm",
title: this.$t( "areYouSure" ),
message: this.$t( "resizeIsPermanent" ),
confirm: async () => {
const { width, height } = this.dimensions;
const scaleX = width / this.activeDocument.width;
const scaleY = height / this.activeDocument.height;
await this.resizeActiveDocumentContent({ scaleX, scaleY });
this.setActiveDocumentSize({ width: Math.round( width ), height: Math.round( height ) });
this.closeModal();
await this.resizeActiveDocumentContent({ scaleX, scaleY });
this.setActiveDocumentSize({ width: Math.round( width ), height: Math.round( height ) });
this.resetHistory();
this.closeModal();
},
cancel: () => {},
});
},
}
};