From 0d29e291626b85eca768f85e5f7bda39c722f65a Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Fri, 17 Mar 2023 16:24:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + web/src/pages/Doc/catalogList.js | 1 + web/src/pages/Doc/en/associativeLine/index.md | 87 +++++++++++++++++++ .../pages/Doc/en/associativeLine/index.vue | 75 ++++++++++++++++ web/src/pages/Doc/en/changelog/index.md | 4 + web/src/pages/Doc/en/changelog/index.vue | 2 + web/src/pages/Doc/en/constructor/index.md | 3 + web/src/pages/Doc/en/constructor/index.vue | 15 ++++ web/src/pages/Doc/en/introduction/index.md | 5 +- web/src/pages/Doc/en/introduction/index.vue | 37 ++++---- web/src/pages/Doc/routerList.js | 2 +- web/src/pages/Doc/zh/associativeLine/index.md | 87 +++++++++++++++++++ .../pages/Doc/zh/associativeLine/index.vue | 75 ++++++++++++++++ web/src/pages/Doc/zh/changelog/index.md | 4 + web/src/pages/Doc/zh/changelog/index.vue | 2 + web/src/pages/Doc/zh/constructor/index.md | 3 + web/src/pages/Doc/zh/constructor/index.vue | 15 ++++ web/src/pages/Doc/zh/introduction/index.md | 5 +- web/src/pages/Doc/zh/introduction/index.vue | 37 ++++---- 19 files changed, 413 insertions(+), 47 deletions(-) create mode 100644 web/src/pages/Doc/en/associativeLine/index.md create mode 100644 web/src/pages/Doc/en/associativeLine/index.vue create mode 100644 web/src/pages/Doc/zh/associativeLine/index.md create mode 100644 web/src/pages/Doc/zh/associativeLine/index.vue diff --git a/README.md b/README.md index 8f8ec49f..999f18cd 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Demo:[https://wanglin2.github.io/mind-map/](https://wanglin2.github.io/mind-ma - [x] 支持多种节点形状 - [x] 支持导出为`json`、`png`、`svg`、`pdf`,支持从`json`、`xmind`导入 - [x] 支持小地图 +- [x] 支持关联线 # 安装 diff --git a/web/src/pages/Doc/catalogList.js b/web/src/pages/Doc/catalogList.js index dfde1397..37a956b8 100644 --- a/web/src/pages/Doc/catalogList.js +++ b/web/src/pages/Doc/catalogList.js @@ -26,6 +26,7 @@ let APIList = [ 'doExport', 'miniMap', 'watermark', + 'associativeLine', 'xmind', 'utils' ] diff --git a/web/src/pages/Doc/en/associativeLine/index.md b/web/src/pages/Doc/en/associativeLine/index.md new file mode 100644 index 00000000..9df673ff --- /dev/null +++ b/web/src/pages/Doc/en/associativeLine/index.md @@ -0,0 +1,87 @@ +# AssociativeLine plugin + +> v0.4.5+ + +This plugin is used to support the addition of associative lines. + +The plugin currently has relatively simple functions, and does not support modifying the control points of association lines or adding text to association lines. + +## Register + +```js +import MindMap from 'simple-mind-map' +import AssociativeLine from 'simple-mind-map/src/AssociativeLine.js' + +MindMap.usePlugin(AssociativeLine) +``` + +After registration and instantiation of `MindMap`, the instance can be obtained through `mindMap.associativeLine`. + +## Config + +Support for modifying the thickness and color of associated lines, divided into default and active states. The configuration is as follows: + +- `associativeLineWidth`: The thickness of the default state of the associated line. The default value is `2` + +- `associativeLineColor`: Color of the default state of associative lines. The default value is `rgb(51, 51, 51)` + +- `associativeLineActiveWidth`: The thickness of the active state of the associated line. The default value is `8` + +- `associativeLineActiveColor`: The color of the active state of the associated line. The default value is `rgba(2, 167, 240, 1)` + +The configuration is provided as a theme, so if you want to modify these four properties, you can modify them using the `mindMap.setThemeConfig(config)` method. + +## Props + +### mindMap.associativeLine.lineList + +Currently, all connection line data, array types, and each item of the array are also an array: + +```js +[ + path, // Connector node + clickPath, // Invisible click line node + node, // Start node + toNode // Target node +] +``` + +### mindMap.associativeLine.activeLine + +The currently active connection line and array type are the same as the structure of each item in the `lineList` array. + +## Methods + +### renderAllLines() + +Re-render all associated lines. + +### removeAllLines() + +Remove all associated lines. + +### createLineFromActiveNode() + +Create an associated line from the current active node. If there are multiple active nodes, the default is the first node. + +After calling this method, an association line will be rendered from the first active node to the current mouse real-time position. When a target node is clicked, it represents completion of creation. An association line will be rendered between the first active node and the clicked node. + +### createLine(fromNode) + +Creates an associative line starting at the specified node. + +After calling this method, an association line will be rendered from the specified node to the current mouse real-time position. When a target node is clicked, it represents completion of creation, and an association line will be rendered between the specified node and the clicked node. + +### addLine(fromNode, toNode) + +Add an associative line directly. + +Calling this method will directly create an association line from the `fromNode` to the `toNode` node. + +### removeLine() + +Deletes the currently active associative line. Clicking on an associated line is considered active. + +### clearActiveLine() + +Clears the active state of the currently active association line. diff --git a/web/src/pages/Doc/en/associativeLine/index.vue b/web/src/pages/Doc/en/associativeLine/index.vue new file mode 100644 index 00000000..8437d5b8 --- /dev/null +++ b/web/src/pages/Doc/en/associativeLine/index.vue @@ -0,0 +1,75 @@ + + + + + \ No newline at end of file diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index ef8f75ae..41fdea69 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -1,5 +1,9 @@ # Changelog +## 0.4.5 + +New: Supports associative lines. + ## 0.4.4 New: Support horizontal scrolling in response to the mouse. diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index c7cddd45..3da216a7 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -1,6 +1,8 @@