修复概要展开收起的定位错误问题
This commit is contained in:
parent
e27eb63627
commit
b901c08156
@ -85,6 +85,9 @@ class Node {
|
|||||||
textContentWidth: 0,
|
textContentWidth: 0,
|
||||||
textContentHeight: 0
|
textContentHeight: 0
|
||||||
}
|
}
|
||||||
|
// 概要节点的宽高
|
||||||
|
this._generalizationNodeWidth = 0
|
||||||
|
this._generalizationNodeHeight = 0
|
||||||
// 各种文字信息的间距
|
// 各种文字信息的间距
|
||||||
this.textContentItemMargin = this.mindMap.opt.textContentMargin
|
this.textContentItemMargin = this.mindMap.opt.textContentMargin
|
||||||
// 图片和文字节点的间距
|
// 图片和文字节点的间距
|
||||||
@ -94,7 +97,7 @@ class Node {
|
|||||||
// 初始渲染
|
// 初始渲染
|
||||||
this.initRender = true
|
this.initRender = true
|
||||||
// 初始化
|
// 初始化
|
||||||
this.createNodeData()
|
// this.createNodeData()
|
||||||
this.getSize()
|
this.getSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,13 +800,23 @@ class Node {
|
|||||||
this._lines = []
|
this._lines = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* javascript comment
|
||||||
|
* @Author: 王林25
|
||||||
|
* @Date: 2022-08-01 09:27:30
|
||||||
|
* @Desc: 检查是否存在概要
|
||||||
|
*/
|
||||||
|
checkHasGeneralization() {
|
||||||
|
return !!this.nodeData.data.generalization
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 王林
|
* @Author: 王林
|
||||||
* @Date: 2022-07-31 09:41:28
|
* @Date: 2022-07-31 09:41:28
|
||||||
* @Desc: 创建概要节点
|
* @Desc: 创建概要节点
|
||||||
*/
|
*/
|
||||||
createGeneralizationNode() {
|
createGeneralizationNode() {
|
||||||
if (this.isGeneralization || !this.nodeData.data.generalization) {
|
if (this.isGeneralization || !this.checkHasGeneralization()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this._generalizationLine) {
|
if (!this._generalizationLine) {
|
||||||
@ -820,6 +833,8 @@ class Node {
|
|||||||
draw: this.draw,
|
draw: this.draw,
|
||||||
isGeneralization: true
|
isGeneralization: true
|
||||||
})
|
})
|
||||||
|
this._generalizationNodeWidth = this._generalizationNode.width
|
||||||
|
this._generalizationNodeHeight = this._generalizationNode.height
|
||||||
this._generalizationNode.generalizationBelongNode = this
|
this._generalizationNode.generalizationBelongNode = this
|
||||||
if (this.nodeData.data.generalization.isActive) {
|
if (this.nodeData.data.generalization.isActive) {
|
||||||
this.renderer.addActiveNode(this._generalizationNode)
|
this.renderer.addActiveNode(this._generalizationNode)
|
||||||
@ -836,7 +851,13 @@ class Node {
|
|||||||
if (this.isGeneralization) {
|
if (this.isGeneralization) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.nodeData.data.expand === false || !this.nodeData.data.generalization) {
|
if (!this.checkHasGeneralization()) {
|
||||||
|
this.removeGeneralization()
|
||||||
|
this._generalizationNodeWidth = 0
|
||||||
|
this._generalizationNodeHeight = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.nodeData.data.expand === false) {
|
||||||
this.removeGeneralization()
|
this.removeGeneralization()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,7 +173,7 @@ class Base {
|
|||||||
* @Desc: 获取节点包括概要在内的宽度
|
* @Desc: 获取节点包括概要在内的宽度
|
||||||
*/
|
*/
|
||||||
getNodeWidthWithGeneralization(node) {
|
getNodeWidthWithGeneralization(node) {
|
||||||
return Math.max(node.width, node._generalizationNode ? node._generalizationNode.width : 0)
|
return Math.max(node.width, node.checkHasGeneralization() ? node._generalizationNodeWidth : 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +182,7 @@ class Base {
|
|||||||
* @Desc: 获取节点包括概要在内的高度
|
* @Desc: 获取节点包括概要在内的高度
|
||||||
*/
|
*/
|
||||||
getNodeHeightWithGeneralization(node) {
|
getNodeHeightWithGeneralization(node) {
|
||||||
return Math.max(node.height, node._generalizationNode ? node._generalizationNode.height : 0)
|
return Math.max(node.height, node.checkHasGeneralization() ? node._generalizationNodeHeight : 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,9 +201,9 @@ class Base {
|
|||||||
root.children.forEach((child) => {
|
root.children.forEach((child) => {
|
||||||
let {left, right, top, bottom} = walk(child)
|
let {left, right, top, bottom} = walk(child)
|
||||||
// 概要内容的宽度
|
// 概要内容的宽度
|
||||||
let generalizationWidth = child._generalizationNode ? child._generalizationNode.width + generalizationNodeMargin : 0
|
let generalizationWidth = child.checkHasGeneralization() ? child._generalizationNodeWidth + generalizationNodeMargin : 0
|
||||||
// 概要内容的高度
|
// 概要内容的高度
|
||||||
let generalizationHeight = child._generalizationNode ? child._generalizationNode.height + generalizationNodeMargin : 0
|
let generalizationHeight = child.checkHasGeneralization() ? child._generalizationNodeHeight + generalizationNodeMargin : 0
|
||||||
if (left < _left) {
|
if (left < _left) {
|
||||||
_left = left - (isLeft ? generalizationWidth : 0)
|
_left = left - (isLeft ? generalizationWidth : 0)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,7 +145,7 @@ class CatalogOrganization extends Base {
|
|||||||
loop(item, width)
|
loop(item, width)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
width += node.width + (node._generalizationNode ? node._generalizationNode.width + this.mindMap.themeConfig.generalizationNodeMargin : 0)
|
width += node.width
|
||||||
widthArr.push(width)
|
widthArr.push(width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user