From 35bff6ab5701e000c2c30d3b9c02cfb98df2bc0b Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Fri, 4 Aug 2023 09:39:21 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E6=9B=B2=E7=BA=BF=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC=E4=B8=8B=EF=BC=8C=E6=A0=B9=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=BA=BF=E6=A0=B7=E5=BC=8F=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=92=8C=E5=85=B6=E4=BB=96=E8=8A=82=E7=82=B9=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/layouts/LogicalStructure.js | 2 +- simple-mind-map/src/layouts/MindMap.js | 2 +- simple-mind-map/src/themes/default.js | 2 ++ web/src/config/en.js | 12 ++++++++ web/src/config/index.js | 8 +++++ web/src/config/zh.js | 12 ++++++++ web/src/lang/en_us.js | 3 +- web/src/lang/zh_cn.js | 3 +- web/src/pages/Edit/components/BaseStyle.vue | 29 ++++++++++++++++++- 9 files changed, 68 insertions(+), 5 deletions(-) diff --git a/simple-mind-map/src/layouts/LogicalStructure.js b/simple-mind-map/src/layouts/LogicalStructure.js index 518bac05..01ac0325 100644 --- a/simple-mind-map/src/layouts/LogicalStructure.js +++ b/simple-mind-map/src/layouts/LogicalStructure.js @@ -234,7 +234,7 @@ class LogicalStructure extends Base { let nodeUseLineStylePath = nodeUseLineStyle ? ` L ${item.left + item.width},${y2}` : '' - if (node.isRoot) { + if (node.isRoot && !this.mindMap.themeConfig.rootLineKeepSameInCurve) { path = this.quadraticCurvePath(x1, y1, x2, y2) + nodeUseLineStylePath } else { path = this.cubicBezierPath(x1, y1, x2, y2) + nodeUseLineStylePath diff --git a/simple-mind-map/src/layouts/MindMap.js b/simple-mind-map/src/layouts/MindMap.js index bdab6c67..6d9f7bf5 100644 --- a/simple-mind-map/src/layouts/MindMap.js +++ b/simple-mind-map/src/layouts/MindMap.js @@ -315,7 +315,7 @@ class MindMap extends Base { nodeUseLineStylePath = ` L ${item.left + item.width},${y2}` } } - if (node.isRoot) { + if (node.isRoot && !this.mindMap.themeConfig.rootLineKeepSameInCurve) { path = this.quadraticCurvePath(x1, y1, x2, y2) + nodeUseLineStylePath } else { path = this.cubicBezierPath(x1, y1, x2, y2) + nodeUseLineStylePath diff --git a/simple-mind-map/src/themes/default.js b/simple-mind-map/src/themes/default.js index c9d9bfa6..6b94a3c8 100644 --- a/simple-mind-map/src/themes/default.js +++ b/simple-mind-map/src/themes/default.js @@ -18,6 +18,8 @@ export default { lineDasharray: 'none', // 连线风格 lineStyle: 'straight', // 针对logicalStructure、mindMap两种结构。曲线(curve)、直线(straight)、直连(direct) + // 曲线连接时,根节点和其他节点的连接线样式保持统一,默认根节点为 ( 型,其他节点为 { 型,设为true后,都为 { 型 + rootLineKeepSameInCurve: true, // 概要连线的粗细 generalizationLineWidth: 1, // 概要连线的颜色 diff --git a/web/src/config/en.js b/web/src/config/en.js index 97aa75d4..9d20c2ec 100644 --- a/web/src/config/en.js +++ b/web/src/config/en.js @@ -102,6 +102,18 @@ export const lineStyleList = [ } ] +// 曲线风格中,根节点样式是否和其他节点保持一致 +export const rootLineKeepSameInCurveList = [ + { + name: 'Bracket', + value: false + }, + { + name: 'Brace', + value: true + } +] + // 图片重复方式 export const backgroundRepeatList = [ { diff --git a/web/src/config/index.js b/web/src/config/index.js index d7a5991d..385fc236 100644 --- a/web/src/config/index.js +++ b/web/src/config/index.js @@ -10,6 +10,7 @@ import { fontFamilyList as fontFamilyListZh, borderDasharrayList as borderDasharrayListZh, lineStyleList as lineStyleListZh, + rootLineKeepSameInCurveList as rootLineKeepSameInCurveListZh, backgroundRepeatList as backgroundRepeatListZh, backgroundPositionList as backgroundPositionListZh, shortcutKeyList as shortcutKeyListZh, @@ -22,6 +23,7 @@ import { fontFamilyList as fontFamilyListEn, borderDasharrayList as borderDasharrayListEn, lineStyleList as lineStyleListEn, + rootLineKeepSameInCurveList as rootLineKeepSameInCurveListEn, backgroundRepeatList as backgroundRepeatListEn, backgroundPositionList as backgroundPositionListEn, shortcutKeyList as shortcutKeyListEn, @@ -46,6 +48,11 @@ const lineStyleList = { en: lineStyleListEn } +const rootLineKeepSameInCurveList = { + zh: rootLineKeepSameInCurveListZh, + en: rootLineKeepSameInCurveListEn +} + const backgroundRepeatList = { zh: backgroundRepeatListZh, en: backgroundRepeatListEn @@ -93,6 +100,7 @@ export { fontFamilyList, borderDasharrayList, lineStyleList, + rootLineKeepSameInCurveList, backgroundRepeatList, backgroundPositionList, backgroundSizeList, diff --git a/web/src/config/zh.js b/web/src/config/zh.js index 6f8d0965..21fccc0a 100644 --- a/web/src/config/zh.js +++ b/web/src/config/zh.js @@ -157,6 +157,18 @@ export const lineStyleList = [ } ] +// 曲线风格中,根节点样式是否和其他节点保持一致 +export const rootLineKeepSameInCurveList = [ + { + name: '括号', + value: false + }, + { + name: '大括号', + value: true + } +] + // 图片重复方式 export const backgroundRepeatList = [ { diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index 17721249..6aa781d4 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -46,7 +46,8 @@ export default { associativeLineActiveColor: 'Active color', mousewheelZoomActionReverse: 'Mouse Wheel Zoom', mousewheelZoomActionReverse1: 'Zoom out forward and zoom in back', - mousewheelZoomActionReverse2: 'Zoom in forward and zoom out back' + mousewheelZoomActionReverse2: 'Zoom in forward and zoom out back', + rootStyle: 'Root Node' }, color: { moreColor: 'More color' diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index 0b15f401..2abef680 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -46,7 +46,8 @@ export default { associativeLineActiveColor: '激活颜色', mousewheelZoomActionReverse: '鼠标滚轮缩放', mousewheelZoomActionReverse1: '向前缩小向后放大', - mousewheelZoomActionReverse2: '向前放大向后缩小' + mousewheelZoomActionReverse2: '向前放大向后缩小', + rootStyle: '根节点' }, color: { moreColor: '更多颜色' diff --git a/web/src/pages/Edit/components/BaseStyle.vue b/web/src/pages/Edit/components/BaseStyle.vue index 45afb6d4..213f6847 100644 --- a/web/src/pages/Edit/components/BaseStyle.vue +++ b/web/src/pages/Edit/components/BaseStyle.vue @@ -164,6 +164,28 @@ +