mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
feature(性能):前进回退操作加入到常量中
This commit is contained in:
parent
44cd5aad96
commit
1e9a603eef
@ -2,6 +2,7 @@
|
||||
export const CONSTANTS = {
|
||||
CHANGE_THEME: 'changeTheme',
|
||||
CHANGE_LAYOUT: 'changeLayout',
|
||||
HISTORY_RECORD:'historyRecord',
|
||||
SET_DATA: 'setData',
|
||||
MODE: {
|
||||
READONLY: 'readonly',
|
||||
|
||||
@ -682,7 +682,7 @@ class Render {
|
||||
if (data) {
|
||||
this.renderTree = data
|
||||
// 给前进后退增加类型 主要是当它这样操作时全量渲染 暂时未作两次数据得变更比对 这个是简单临时方案
|
||||
this.mindMap.render(()=>{},"HISTORY_RECORD")
|
||||
this.mindMap.render(()=>{},CONSTANTS.HISTORY_RECORD)
|
||||
}
|
||||
this.mindMap.emit('data_change', data)
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ class LogicalStructure extends Base {
|
||||
(cur, parent, isRoot, layerIndex, index, ancestors) => {
|
||||
let newNode = cur?._node
|
||||
// 只有变动的节点 结构改变 和 执行撤销和前进的操作才进入创建节点的操作
|
||||
if(!newNode || activeUiDList.includes(cur.data.uid) || this.checkIsNeedResizeSources() || this.renderer.renderSource === CONSTANTS.CHANGE_LAYOUT || this.renderer.renderSource === "HISTORY_RECORD"){
|
||||
if(!newNode || activeUiDList.includes(cur.data.uid) || this.checkIsNeedResizeSources() || [CONSTANTS.CHANGE_LAYOUT,CONSTANTS.HISTORY_RECORD].includes(this.renderer.renderSource)){
|
||||
newNode = this.createNode(cur, parent, isRoot, layerIndex, index, ancestors,this.renderer.renderSource !== "HISTORY_RECORD")
|
||||
}
|
||||
// 将缓存节点移至外边去缓存。保证每个节点缓存都是最新的
|
||||
|
||||
Loading…
Reference in New Issue
Block a user