Feat:直连风格根节点的连线起点统一为节点的边界

This commit is contained in:
街角小林 2024-01-24 18:51:39 +08:00
parent 95b957d37e
commit cf87333910
3 changed files with 12 additions and 8 deletions

View File

@ -197,10 +197,12 @@ class LogicalStructure extends Base {
if (!this.mindMap.opt.alwaysShowExpandBtn) { if (!this.mindMap.opt.alwaysShowExpandBtn) {
expandBtnSize = 0 expandBtnSize = 0
} }
let nodeUseLineStyle = this.mindMap.themeConfig.nodeUseLineStyle const { nodeUseLineStyle } = this.mindMap.themeConfig
node.children.forEach((item, index) => { node.children.forEach((item, index) => {
let x1 = if (node.layerIndex === 0) {
node.layerIndex === 0 ? left + width / 2 : left + width + expandBtnSize expandBtnSize = 0
}
let x1 = left + width + expandBtnSize
let y1 = top + height / 2 let y1 = top + height / 2
let x2 = item.left let x2 = item.left
let y2 = item.top + item.height / 2 let y2 = item.top + item.height / 2

View File

@ -259,12 +259,13 @@ class MindMap extends Base {
if (!this.mindMap.opt.alwaysShowExpandBtn) { if (!this.mindMap.opt.alwaysShowExpandBtn) {
expandBtnSize = 0 expandBtnSize = 0
} }
let nodeUseLineStyle = this.mindMap.themeConfig.nodeUseLineStyle const { nodeUseLineStyle } = this.mindMap.themeConfig
node.children.forEach((item, index) => { node.children.forEach((item, index) => {
if (node.layerIndex === 0) {
expandBtnSize = 0
}
let x1 = let x1 =
node.layerIndex === 0 item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT
? left + width / 2
: item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT
? left - expandBtnSize ? left - expandBtnSize
: left + width + expandBtnSize : left + width + expandBtnSize
let y1 = top + height / 2 let y1 = top + height / 2

View File

@ -161,13 +161,14 @@ class OrganizationStructure extends Base {
return [] return []
} }
let { left, top, width, height } = node let { left, top, width, height } = node
const { nodeUseLineStyle } = this.mindMap.themeConfig
let x1 = left + width / 2 let x1 = left + width / 2
let y1 = top + height let y1 = top + height
node.children.forEach((item, index) => { node.children.forEach((item, index) => {
let x2 = item.left + item.width / 2 let x2 = item.left + item.width / 2
let y2 = item.top let y2 = item.top
// 节点使用横线风格,需要额外渲染横线 // 节点使用横线风格,需要额外渲染横线
let nodeUseLineStylePath = this.mindMap.themeConfig.nodeUseLineStyle let nodeUseLineStylePath = nodeUseLineStyle
? ` L ${item.left},${y2} L ${item.left + item.width},${y2}` ? ` L ${item.left},${y2} L ${item.left + item.width},${y2}`
: '' : ''
let path = `M ${x1},${y1} L ${x2},${y2}` + nodeUseLineStylePath let path = `M ${x1},${y1} L ${x2},${y2}` + nodeUseLineStylePath