Feat:存在激活节点时点击关联线可直接激活关联线
This commit is contained in:
parent
73e7855575
commit
c0ad18cff8
@ -257,28 +257,25 @@ class AssociativeLine {
|
|||||||
}) {
|
}) {
|
||||||
let { associativeLineActiveColor } = this.mindMap.themeConfig
|
let { associativeLineActiveColor } = this.mindMap.themeConfig
|
||||||
// 如果当前存在激活节点,那么取消激活节点
|
// 如果当前存在激活节点,那么取消激活节点
|
||||||
if (this.mindMap.renderer.activeNodeList.length > 0) {
|
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
||||||
this.clearActiveNodes()
|
// 否则清除当前的关联线的激活状态,如果有的话
|
||||||
} else {
|
this.clearActiveLine()
|
||||||
// 否则清除当前的关联线的激活状态,如果有的话
|
// 保存当前激活的关联线信息
|
||||||
this.clearActiveLine()
|
this.activeLine = [path, clickPath, text, node, toNode]
|
||||||
// 保存当前激活的关联线信息
|
// 让不可见的点击线显示
|
||||||
this.activeLine = [path, clickPath, text, node, toNode]
|
clickPath.stroke({ color: associativeLineActiveColor })
|
||||||
// 让不可见的点击线显示
|
// 如果没有输入过关联线文字,那么显示默认文字
|
||||||
clickPath.stroke({ color: associativeLineActiveColor })
|
if (!this.getText(node, toNode)) {
|
||||||
// 如果没有输入过关联线文字,那么显示默认文字
|
this.renderText(this.mindMap.opt.defaultAssociativeLineText, path, text)
|
||||||
if (!this.getText(node, toNode)) {
|
|
||||||
this.renderText(this.mindMap.opt.defaultAssociativeLineText, path, text)
|
|
||||||
}
|
|
||||||
// 渲染控制点和连线
|
|
||||||
this.renderControls(
|
|
||||||
startPoint,
|
|
||||||
endPoint,
|
|
||||||
controlPoints[0],
|
|
||||||
controlPoints[1]
|
|
||||||
)
|
|
||||||
this.mindMap.emit('associative_line_click', path, clickPath, node, toNode)
|
|
||||||
}
|
}
|
||||||
|
// 渲染控制点和连线
|
||||||
|
this.renderControls(
|
||||||
|
startPoint,
|
||||||
|
endPoint,
|
||||||
|
controlPoints[0],
|
||||||
|
controlPoints[1]
|
||||||
|
)
|
||||||
|
this.mindMap.emit('associative_line_click', path, clickPath, node, toNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除所有连接线
|
// 移除所有连接线
|
||||||
@ -488,13 +485,6 @@ class AssociativeLine {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除当前激活的节点
|
|
||||||
clearActiveNodes() {
|
|
||||||
if (this.mindMap.renderer.activeNodeList.length > 0) {
|
|
||||||
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清除激活的线
|
// 清除激活的线
|
||||||
clearActiveLine() {
|
clearActiveLine() {
|
||||||
if (this.activeLine) {
|
if (this.activeLine) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user