Feat:主题新增字段用于设置曲线连接下根节点连线的起始位置
This commit is contained in:
parent
7d18f98a33
commit
95b957d37e
@ -224,10 +224,19 @@ 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,
|
||||||
|
rootLineStartPositionKeepSameInCurve,
|
||||||
|
rootLineKeepSameInCurve
|
||||||
|
} = 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 ? left + width / 2 : left + width + expandBtnSize
|
node.layerIndex === 0 && !rootLineStartPositionKeepSameInCurve
|
||||||
|
? left + width / 2
|
||||||
|
: 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
|
||||||
@ -238,7 +247,7 @@ class LogicalStructure extends Base {
|
|||||||
let nodeUseLineStylePath = nodeUseLineStyle
|
let nodeUseLineStylePath = nodeUseLineStyle
|
||||||
? ` L ${item.left + item.width},${y2}`
|
? ` L ${item.left + item.width},${y2}`
|
||||||
: ''
|
: ''
|
||||||
if (node.isRoot && !this.mindMap.themeConfig.rootLineKeepSameInCurve) {
|
if (node.isRoot && !rootLineKeepSameInCurve) {
|
||||||
path = this.quadraticCurvePath(x1, y1, x2, y2) + nodeUseLineStylePath
|
path = this.quadraticCurvePath(x1, y1, x2, y2) + nodeUseLineStylePath
|
||||||
} else {
|
} else {
|
||||||
path = this.cubicBezierPath(x1, y1, x2, y2) + nodeUseLineStylePath
|
path = this.cubicBezierPath(x1, y1, x2, y2) + nodeUseLineStylePath
|
||||||
|
|||||||
@ -298,10 +298,17 @@ 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,
|
||||||
|
rootLineKeepSameInCurve,
|
||||||
|
rootLineStartPositionKeepSameInCurve
|
||||||
|
} = 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
|
node.layerIndex === 0 && !rootLineStartPositionKeepSameInCurve
|
||||||
? left + width / 2
|
? left + width / 2
|
||||||
: item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT
|
: item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT
|
||||||
? left - expandBtnSize
|
? left - expandBtnSize
|
||||||
@ -317,14 +324,14 @@ class MindMap extends Base {
|
|||||||
y2 = nodeUseLineStyle ? y2 + item.height / 2 : y2
|
y2 = nodeUseLineStyle ? y2 + item.height / 2 : y2
|
||||||
// 节点使用横线风格,需要额外渲染横线
|
// 节点使用横线风格,需要额外渲染横线
|
||||||
let nodeUseLineStylePath = ''
|
let nodeUseLineStylePath = ''
|
||||||
if (this.mindMap.themeConfig.nodeUseLineStyle) {
|
if (nodeUseLineStyle) {
|
||||||
if (item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT) {
|
if (item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT) {
|
||||||
nodeUseLineStylePath = ` L ${item.left},${y2}`
|
nodeUseLineStylePath = ` L ${item.left},${y2}`
|
||||||
} else {
|
} else {
|
||||||
nodeUseLineStylePath = ` L ${item.left + item.width},${y2}`
|
nodeUseLineStylePath = ` L ${item.left + item.width},${y2}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node.isRoot && !this.mindMap.themeConfig.rootLineKeepSameInCurve) {
|
if (node.isRoot && !rootLineKeepSameInCurve) {
|
||||||
path = this.quadraticCurvePath(x1, y1, x2, y2) + nodeUseLineStylePath
|
path = this.quadraticCurvePath(x1, y1, x2, y2) + nodeUseLineStylePath
|
||||||
} else {
|
} else {
|
||||||
path = this.cubicBezierPath(x1, y1, x2, y2) + nodeUseLineStylePath
|
path = this.cubicBezierPath(x1, y1, x2, y2) + nodeUseLineStylePath
|
||||||
|
|||||||
@ -20,6 +20,8 @@ export default {
|
|||||||
lineStyle: 'straight', // 曲线(curve)【仅支持logicalStructure、mindMap、verticalTimeline三种结构】、直线(straight)、直连(direct)【仅支持logicalStructure、mindMap、organizationStructure、verticalTimeline四种结构】
|
lineStyle: 'straight', // 曲线(curve)【仅支持logicalStructure、mindMap、verticalTimeline三种结构】、直线(straight)、直连(direct)【仅支持logicalStructure、mindMap、organizationStructure、verticalTimeline四种结构】
|
||||||
// 曲线连接时,根节点和其他节点的连接线样式保持统一,默认根节点为 ( 型,其他节点为 { 型,设为true后,都为 { 型。仅支持logicalStructure、mindMap两种结构
|
// 曲线连接时,根节点和其他节点的连接线样式保持统一,默认根节点为 ( 型,其他节点为 { 型,设为true后,都为 { 型。仅支持logicalStructure、mindMap两种结构
|
||||||
rootLineKeepSameInCurve: true,
|
rootLineKeepSameInCurve: true,
|
||||||
|
// 曲线连接时,根节点和其他节点的连线起始位置保持统一,默认根节点的连线起始位置在节点中心,其他节点在节点右侧,如果该配置设为true,那么根节点的连线起始位置也会在节点右侧
|
||||||
|
rootLineStartPositionKeepSameInCurve: false,
|
||||||
// 直线连接(straight)时,连线的圆角大小,设置为0代表没有圆角,仅支持logicalStructure、mindMap、verticalTimeline三种结构
|
// 直线连接(straight)时,连线的圆角大小,设置为0代表没有圆角,仅支持logicalStructure、mindMap、verticalTimeline三种结构
|
||||||
lineRadius: 5,
|
lineRadius: 5,
|
||||||
// 连线是否显示标记,目前只支持箭头
|
// 连线是否显示标记,目前只支持箭头
|
||||||
@ -180,6 +182,7 @@ const nodeSizeIndependenceList = [
|
|||||||
'backgroundPosition',
|
'backgroundPosition',
|
||||||
'backgroundSize',
|
'backgroundSize',
|
||||||
'rootLineKeepSameInCurve',
|
'rootLineKeepSameInCurve',
|
||||||
|
'rootLineStartPositionKeepSameInCurve',
|
||||||
'showLineMarker',
|
'showLineMarker',
|
||||||
'gradientStyle',
|
'gradientStyle',
|
||||||
'lineRadius',
|
'lineRadius',
|
||||||
|
|||||||
@ -59,7 +59,10 @@ export default {
|
|||||||
fontFamily: 'Font family',
|
fontFamily: 'Font family',
|
||||||
fontSize: 'Font size',
|
fontSize: 'Font size',
|
||||||
isShowScrollbar: 'Is show scrollbar',
|
isShowScrollbar: 'Is show scrollbar',
|
||||||
isUseHandDrawnLikeStyle: 'Is use hand drawn like style'
|
isUseHandDrawnLikeStyle: 'Is use hand drawn like style',
|
||||||
|
rootLineStartPos: 'Root line start pos',
|
||||||
|
center: 'Center',
|
||||||
|
right: 'Right'
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
moreColor: 'More color'
|
moreColor: 'More color'
|
||||||
|
|||||||
@ -59,7 +59,10 @@ export default {
|
|||||||
fontFamily: '字体',
|
fontFamily: '字体',
|
||||||
fontSize: '字号',
|
fontSize: '字号',
|
||||||
isShowScrollbar: '是否显示滚动条',
|
isShowScrollbar: '是否显示滚动条',
|
||||||
isUseHandDrawnLikeStyle: '是否开启手绘风格'
|
isUseHandDrawnLikeStyle: '是否开启手绘风格',
|
||||||
|
rootLineStartPos: '根节点连线起始位置',
|
||||||
|
center: '中心',
|
||||||
|
right: '右侧'
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
moreColor: '更多颜色'
|
moreColor: '更多颜色'
|
||||||
|
|||||||
@ -148,6 +148,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<!-- 线宽 -->
|
||||||
<div class="rowItem" v-if="lineStyleListShow.length > 1">
|
<div class="rowItem" v-if="lineStyleListShow.length > 1">
|
||||||
<span class="name">{{ $t('baseStyle.style') }}</span>
|
<span class="name">{{ $t('baseStyle.style') }}</span>
|
||||||
<el-select
|
<el-select
|
||||||
@ -176,6 +177,7 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 根节点连线样式 -->
|
||||||
<div
|
<div
|
||||||
class="rowItem"
|
class="rowItem"
|
||||||
v-if="
|
v-if="
|
||||||
@ -204,6 +206,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="rowItem" v-if="showLineRadius">
|
<div class="rowItem" v-if="showLineRadius">
|
||||||
|
<!-- 连线圆角大小 -->
|
||||||
<span class="name">{{ $t('baseStyle.lineRadius') }}</span>
|
<span class="name">{{ $t('baseStyle.lineRadius') }}</span>
|
||||||
<el-select
|
<el-select
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -226,6 +229,37 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<!-- 根节点连线起始位置 -->
|
||||||
|
<div
|
||||||
|
class="rowItem"
|
||||||
|
v-if="
|
||||||
|
style.lineStyle === 'curve' && showRootLineKeepSameInCurveLayouts
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<span class="name">{{ $t('baseStyle.rootLineStartPos') }}</span>
|
||||||
|
<el-select
|
||||||
|
size="mini"
|
||||||
|
style="width: 80px"
|
||||||
|
v-model="style.rootLineStartPositionKeepSameInCurve"
|
||||||
|
placeholder=""
|
||||||
|
@change="
|
||||||
|
value => {
|
||||||
|
update('rootLineStartPositionKeepSameInCurve', value)
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
key="center"
|
||||||
|
:label="$t('baseStyle.center')"
|
||||||
|
:value="false"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
<el-option key="right" :label="$t('baseStyle.right')" :value="true">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="rowItem">
|
<div class="rowItem">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
@ -917,6 +951,7 @@ export default {
|
|||||||
lineStyle: '',
|
lineStyle: '',
|
||||||
showLineMarker: '',
|
showLineMarker: '',
|
||||||
rootLineKeepSameInCurve: '',
|
rootLineKeepSameInCurve: '',
|
||||||
|
rootLineStartPositionKeepSameInCurve: '',
|
||||||
lineRadius: 0,
|
lineRadius: 0,
|
||||||
generalizationLineWidth: '',
|
generalizationLineWidth: '',
|
||||||
generalizationLineColor: '',
|
generalizationLineColor: '',
|
||||||
@ -1076,6 +1111,7 @@ export default {
|
|||||||
'lineStyle',
|
'lineStyle',
|
||||||
'showLineMarker',
|
'showLineMarker',
|
||||||
'rootLineKeepSameInCurve',
|
'rootLineKeepSameInCurve',
|
||||||
|
'rootLineStartPositionKeepSameInCurve',
|
||||||
'lineRadius',
|
'lineRadius',
|
||||||
'lineColor',
|
'lineColor',
|
||||||
'generalizationLineWidth',
|
'generalizationLineWidth',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user