From a25b0f61a215fe82842739c4c2b15aabd7aaed72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Thu, 26 Sep 2024 18:17:10 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E5=B8=83=E6=98=AF=E5=90=A6=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/Edit/components/Edit.vue | 20 +++++++++++++++---- .../Workbenche/components/SettingDialog.vue | 15 ++++++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue index a6549885..137df723 100644 --- a/web/src/pages/Edit/components/Edit.vue +++ b/web/src/pages/Edit/components/Edit.vue @@ -200,7 +200,9 @@ export default { autoSaveTimer: null, isNewFile: false, storeConfigTimer: null, - showDragMask: false + showDragMask: false, + lastViewData: null, + clientConfig: null } }, computed: { @@ -320,9 +322,9 @@ export default { */ async getData() { let data = await window.electronAPI.getFileContent(this.$route.params.id) - const clientConfig = await window.electronAPI.getClientConfig() - const defaultTheme = clientConfig.theme || 'classic4' - const defaultLayout = clientConfig.layout || 'logicalStructure' + this.clientConfig = await window.electronAPI.getClientConfig() + const defaultTheme = this.clientConfig.theme || 'classic4' + const defaultLayout = this.clientConfig.layout || 'logicalStructure' let storeData = null if (data) { this.setFileName(data.name) @@ -368,6 +370,15 @@ export default { storeData(data) }) this.$bus.$on('view_data_change', data => { + if ( + (!this.clientConfig || !this.clientConfig.viewTranslateChangeTriggerAutoSave) && + this.lastViewData.transform.scaleX === data.transform.scaleX && + this.lastViewData.transform.scaleY === data.transform.scaleY + ) { + this.lastViewData = simpleDeepClone(data) + return + } + this.lastViewData = simpleDeepClone(data) this.autoSave() this.setIsUnSave(true) clearTimeout(this.storeConfigTimer) @@ -621,6 +632,7 @@ export default { // return el // } }) + this.lastViewData = simpleDeepClone(this.mindMap.view.getTransformData()) if (this.openNodeRichText) this.addRichTextPlugin() if (this.isShowScrollbar) this.addScrollbarPlugin() if (this.isUseHandDrawnLikeStyle) this.addHandDrawnLikeStylePlugin() diff --git a/web/src/pages/Workbenche/components/SettingDialog.vue b/web/src/pages/Workbenche/components/SettingDialog.vue index 88afab1b..b67c8757 100644 --- a/web/src/pages/Workbenche/components/SettingDialog.vue +++ b/web/src/pages/Workbenche/components/SettingDialog.vue @@ -51,6 +51,13 @@ alt="" /> +
+
拖动画布触发自动保存
+ +
@@ -80,7 +87,8 @@ export default { dialogVisible: false, config: { layout: '', - theme: '' + theme: '', + viewTranslateChangeTriggerAutoSave: false }, clientConfig: null } @@ -105,6 +113,8 @@ export default { this.clientConfig = await window.electronAPI.getClientConfig() this.config.layout = this.clientConfig.layout || 'logicalStructure' this.config.theme = this.clientConfig.theme || 'classic4' + this.config.viewTranslateChangeTriggerAutoSave = + this.clientConfig.viewTranslateChangeTriggerAutoSave || false }, onChange() { @@ -132,7 +142,8 @@ export default { margin-bottom: 12px; .label { - width: 100px; + width: 90px; + margin-right: 12px; } img {