mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
Feat:增加拖动画布是否触发自动保存的设置
This commit is contained in:
parent
6da7cf8284
commit
a25b0f61a2
@ -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()
|
||||
|
||||
@ -51,6 +51,13 @@
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="label">拖动画布触发自动保存</div>
|
||||
<el-checkbox
|
||||
v-model="config.viewTranslateChangeTriggerAutoSave"
|
||||
@change="onChange"
|
||||
></el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user