Feature:添加最大历史记录数限制
This commit is contained in:
parent
2be97cc1a0
commit
077478d654
@ -101,7 +101,9 @@ const defaultOpt = {
|
|||||||
// 节点备注浮层的z-index
|
// 节点备注浮层的z-index
|
||||||
nodeNoteTooltipZIndex: 3000,
|
nodeNoteTooltipZIndex: 3000,
|
||||||
// 是否在点击了画布外的区域时结束节点文本的编辑状态
|
// 是否在点击了画布外的区域时结束节点文本的编辑状态
|
||||||
isEndNodeTextEditOnClickOuter: true
|
isEndNodeTextEditOnClickOuter: true,
|
||||||
|
// 最大历史记录数
|
||||||
|
maxHistoryCount: 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
// 思维导图
|
// 思维导图
|
||||||
|
|||||||
@ -84,6 +84,10 @@ class Command {
|
|||||||
// 删除当前历史指针后面的数据
|
// 删除当前历史指针后面的数据
|
||||||
this.history = this.history.slice(0, this.activeHistoryIndex + 1)
|
this.history = this.history.slice(0, this.activeHistoryIndex + 1)
|
||||||
this.history.push(simpleDeepClone(data))
|
this.history.push(simpleDeepClone(data))
|
||||||
|
// 历史记录数超过最大数量
|
||||||
|
if (this.history.length > this.mindMap.opt.maxHistoryCount) {
|
||||||
|
this.history.shift()
|
||||||
|
}
|
||||||
this.activeHistoryIndex = this.history.length - 1
|
this.activeHistoryIndex = this.history.length - 1
|
||||||
this.mindMap.emit('data_change', this.removeDataUid(data))
|
this.mindMap.emit('data_change', this.removeDataUid(data))
|
||||||
this.mindMap.emit(
|
this.mindMap.emit(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user