mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Feat:只读模式下节点实例不保存nodeDataSnapshot数据
This commit is contained in:
@@ -475,8 +475,12 @@ class MindMapNode {
|
||||
return
|
||||
}
|
||||
this.updateNodeActiveClass()
|
||||
const { alwaysShowExpandBtn, notShowExpandBtn, isShowCreateChildBtnIcon } =
|
||||
this.mindMap.opt
|
||||
const {
|
||||
alwaysShowExpandBtn,
|
||||
notShowExpandBtn,
|
||||
isShowCreateChildBtnIcon,
|
||||
readonly
|
||||
} = this.mindMap.opt
|
||||
const childrenLength = this.getChildrenLength()
|
||||
// 不显示展开收起按钮则不需要处理
|
||||
if (!notShowExpandBtn) {
|
||||
@@ -522,7 +526,7 @@ class MindMapNode {
|
||||
// 更新节点位置
|
||||
const t = this.group.transform()
|
||||
// 保存一份当前节点数据快照
|
||||
this.nodeDataSnapshot = JSON.stringify(this.getData())
|
||||
this.nodeDataSnapshot = readonly ? '' : JSON.stringify(this.getData())
|
||||
// 节点位置变化才更新,因为即使值没有变化属性设置操作也是耗时的
|
||||
if (this.left !== t.translateX || this.top !== t.translateY) {
|
||||
this.group.translate(this.left - t.translateX, this.top - t.translateY)
|
||||
|
||||
Reference in New Issue
Block a user