Compare commits

...

47 Commits

Author SHA1 Message Date
街角小林
bc1cf71eaa update 2024-07-03 11:21:24 +08:00
街角小林
d929792157 打包0.10.2 2024-07-03 11:18:29 +08:00
街角小林
658b47b72e Doc: update 2024-07-03 11:07:50 +08:00
街角小林
591e6a5b2a Demo:1.小地图支持拖拽视图框调整画布位置;2.鼠标移出小地图停止鼠标事件; 2024-07-03 09:18:18 +08:00
街角小林
58baf4c0aa Feat:小地图支持拖拽视图框调整画布位置 2024-07-03 09:17:26 +08:00
街角小林
00f86fe167 Demo:修复鼠标移出小地图再松开后事件没有结束的问题 2024-07-02 16:30:19 +08:00
街角小林
5c1e5f072c Demo:新增向左逻辑结构图 2024-07-02 11:46:42 +08:00
街角小林
b45674cf8f Feat:新增向左逻辑结构图 2024-07-02 11:46:03 +08:00
街角小林
c23a16e65a Doc: update 2024-07-02 10:33:13 +08:00
街角小林
b7722987b1 Demo:右键菜单新增复制到剪贴板功能 2024-07-02 10:30:54 +08:00
街角小林
1fc5b951a0 Demo:新增外框设置功能 2024-07-01 17:22:10 +08:00
街角小林
53eb608007 Demo:颜色选择支持选择透明度 2024-07-01 17:16:11 +08:00
街角小林
876afb2504 Feat:新增外框插件 2024-07-01 17:15:48 +08:00
街角小林
4d1608e8c4 Fix:修复拖动关联线端点移动时会选中节点文字的问题 2024-06-27 16:50:25 +08:00
街角小林
80f45e5e7d Doc: update 2024-06-27 09:26:04 +08:00
街角小林
f80317a449 Doc: update 2024-06-26 16:03:13 +08:00
街角小林
9bce6d3ded update 2024-06-25 16:33:08 +08:00
街角小林
16e40b4342 Fix:修复节点文本和createNodePrefixContent选项自定义的内容没有垂直居中的问题 2024-06-25 16:25:20 +08:00
街角小林
624203ea84 Feat:点击超链接图标时激活节点;新增自定义超链接跳转的实例化选项 2024-06-25 15:53:06 +08:00
街角小林
6ffa4570d4 Feat:hide_text_edit事件增加被编辑节点的回调参数 2024-06-25 09:45:59 +08:00
街角小林
d99a4dcc33 Feat:将Select插件的画布自动移动功能独立出来,解决没有注册Select插件的情况下Drag插件无法使用画布自动移动功能的问题 2024-06-25 09:35:34 +08:00
街角小林
e8c4aad690 Feat:新增禁止读取和写入用户剪贴板的实例化选项 2024-06-24 19:03:47 +08:00
街角小林
35c8e129f0 Feat:drag插件的beforeDragEnd选项新增当前被拖拽的节点列表的回调参数 2024-06-24 18:54:31 +08:00
街角小林
dc096fd535 Feat:阻止mousedown、mousemove、drag、node_mousedown事件的默认行为 2024-06-24 18:52:36 +08:00
街角小林
a047dabbd0 Feat:新增拦截节点开始拖拽的实例化选项 2024-06-24 18:42:14 +08:00
街角小林
1ec723db0e Doc: update 2024-06-24 18:29:14 +08:00
街角小林
d9fc209dac Doc: update 2024-06-20 09:53:23 +08:00
街角小林
8647cb5893 Demo update 2024-06-14 15:38:33 +08:00
街角小林
264875e14e 打包0.10.1 2024-06-14 15:23:07 +08:00
街角小林
de423f3bd3 Doc: update 2024-06-14 15:06:56 +08:00
街角小林
fcdcda929c Fix:修复/快捷键能收起根节点的子节点的问题 2024-06-14 14:03:35 +08:00
街角小林
1cfd50a42b update 2024-06-13 19:21:35 +08:00
街角小林
f794df4e6f Feat:新增限制TouchEvent插件双指缩放的最大值和最小值 2024-06-13 19:12:24 +08:00
街角小林
eea1109e43 Feat:新增拦截节点拖拽的实例化选项 2024-06-13 18:48:48 +08:00
街角小林
65004d08cd Feat:render.moveNodeToCenter方法新增第二个参数指定是否重直画布的缩放 2024-06-13 16:52:39 +08:00
街角小林
44d75ef7f4 Demo:移动端打开时不显示目录、新建、打开按钮 2024-06-13 16:29:16 +08:00
街角小林
1f473b79e9 Fix:修复TouchEvent插件两次点击位置不同时也会触发节点输入的问题 2024-06-13 16:26:51 +08:00
街角小林
8ad26da5d7 Demo:修复演示模式中右下角输入框无法输入的问题 2024-06-13 15:44:56 +08:00
街角小林
e7f1608605 Demo:新增节点标记功能 2024-06-13 15:01:22 +08:00
街角小林
d14fb0b666 Feat:新增单个节点内容布局完成事件 2024-06-13 14:43:17 +08:00
街角小林
a55401de23 Feat:新增修改拖拽节点时克隆的节点的实例化选项 2024-06-13 14:34:14 +08:00
街角小林
a9ad38e39b Demo: update 2024-06-13 09:33:58 +08:00
街角小林
4f5746680d Feat:新增处理导出前的svg对象的实例化选项 2024-06-13 09:32:32 +08:00
街角小林
b7d906d1ea Doc: update 2024-06-06 09:14:24 +08:00
街角小林
1181871772 update 2024-06-05 15:49:33 +08:00
街角小林
93df2d7950 update 2024-06-05 15:47:09 +08:00
街角小林
09633dda58 Feat:降级Formula插件中较新的js语法 2024-06-05 15:46:16 +08:00
145 changed files with 3371 additions and 463 deletions

View File

@@ -28,7 +28,7 @@ Github[releases](https://github.com/wanglin2/mind-map/releases)。百度云
# 特性
- [x] 插件化架构,除核心功能外,其他功能作为插件提供,按需使用,减小打包体积
- [x] 支持逻辑结构图、思维导图、组织结构图、目录组织图、时间轴(横向、竖向)、鱼骨图等结构
- [x] 支持逻辑结构图(向左、向右逻辑结构图)、思维导图、组织结构图、目录组织图、时间轴(横向、竖向)、鱼骨图等结构
- [x] 内置多种主题,允许高度自定义样式,支持注册新主题
- [x] 节点内容支持文本(普通文本、富文本)、图片、图标、超链接、备注、标签、概要、数学公式
- [x] 节点支持拖拽(拖拽移动、自由调整)、多种节点形状;支持扩展节点内容、支持使用 DDM 完全自定义节点内容
@@ -42,7 +42,7 @@ Github[releases](https://github.com/wanglin2/mind-map/releases)。百度云
官方提供了如下插件,可根据需求按需引入(某个功能不生效大概率是因为你没有引入对应的插件),具体使用方式请查看文档:
> RichText节点富文本插件、Select鼠标多选节点插件、Drag节点拖拽插件、AssociativeLine关联线插件、Export导出插件、KeyboardNavigation键盘导航插件、MiniMap小地图插件、Watermark水印插件、TouchEvent移动端触摸事件支持插件、NodeImgAdjust拖拽调整节点图片大小插件、Search搜索插件、Painter节点格式刷插件、Scrollbar滚动条插件、Formula数学公式插件、Cooperate协同编辑插件、RainbowLines彩虹线条插件、Demonstrate演示模式插件、HandDrawnLikeStyle手绘风格插件[收费]
> RichText节点富文本插件、Select鼠标多选节点插件、Drag节点拖拽插件、AssociativeLine关联线插件、Export导出插件、KeyboardNavigation键盘导航插件、MiniMap小地图插件、Watermark水印插件、TouchEvent移动端触摸事件支持插件、NodeImgAdjust拖拽调整节点图片大小插件、Search搜索插件、Painter节点格式刷插件、Scrollbar滚动条插件、Formula数学公式插件、Cooperate协同编辑插件、RainbowLines彩虹线条插件、Demonstrate演示模式插件OuterFrame外框插件HandDrawnLikeStyle手绘风格插件[收费]、Notation节点标记插件[收费]
本项目不会实现的特性:
@@ -111,7 +111,7 @@ const mindMap = new MindMap({
# 关于定制
如果你有个性化的商用定制需求,可以联系我们,我们提供付费开发服务。
如果你有个性化的商用定制需求,可以联系我们,我们提供付费开发服务,无论前端、后端、还是部署,都可以帮你一站式搞定
# 请作者喝杯咖啡
@@ -358,7 +358,7 @@ const mindMap = new MindMap({
<span>庆国</span>
</span>
<span>
<img src="./web/src/assets/avatar/孟照星.jpg" style="width: 50px;height: 50px;" />
<img src="./web/src/assets/avatar/Alex.jpg" style="width: 50px;height: 50px;" />
<span>Alex</span>
</span>
<span>
@@ -385,4 +385,32 @@ const mindMap = new MindMap({
<img src="./web/src/assets/avatar/峰.jpg" style="width: 50px;height: 50px;" />
<span>峰</span>
</span>
<span>
<img src="./web/src/assets/avatar/default.png" style="width: 50px;height: 50px;" />
<span>协成</span>
</span>
<span>
<img src="./web/src/assets/avatar/木木.jpg" style="width: 50px;height: 50px;" />
<span>木木</span>
</span>
<span>
<img src="./web/src/assets/avatar/好名字.jpg" style="width: 50px;height: 50px;" />
<span>好名字</span>
</span>
<span>
<img src="./web/src/assets/avatar/Kyle.jpg" style="width: 50px;height: 50px;" />
<span>Kyle</span>
</span>
<span>
<img src="./web/src/assets/avatar/lsytyrt.jpg" style="width: 50px;height: 50px;" />
<span>lsytyrt</span>
</span>
<span>
<img src="./web/src/assets/avatar/秀树因馨雨.jpg" style="width: 50px;height: 50px;" />
<span>秀树因馨雨</span>
</span>
<span>
<img src="./web/src/assets/avatar/buddy.jpg" style="width: 50px;height: 50px;" />
<span>buddy</span>
</span>
</p>

View File

@@ -13,4 +13,4 @@ if (fs.existsSync(src)) {
fs.unlinkSync(src)
}
console.warn('请检查手绘风格选项是否开启')
console.warn('请检查手绘风格、标记插件是否启用')

2
dist/css/app.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

BIN
dist/img/Kyle.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
dist/img/buddy.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
dist/img/logicalStructureLeft.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
dist/img/好名字.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
dist/img/木木.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
dist/img/标记.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
dist/img/秀树因馨雨.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
dist/img/错误.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

2
dist/js/app.js vendored

File diff suppressed because one or more lines are too long

1
dist/js/chunk-02087b0a.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0abe0f"],{"16c7":function(e,t,o){"use strict";o.r(t);var a=function(){var e=this;e._self._c;return e._m(0)},n=[function(){var e=this,t=e._self._c;return t("div",[t("h1",[e._v("View instance")]),t("p",[e._v("The "),t("code",[e._v("view")]),e._v(" instance is responsible for view operations, and can be obtained through "),t("code",[e._v("mindMap.view")])]),t("h2",[e._v("Methods")]),t("h3",[e._v("fit()")]),t("blockquote",[t("p",[e._v("v0.6.0+")])]),t("p",[e._v("Zoom the mind map to fit the canvas.")]),t("p",[e._v("Note that this method cannot be called immediately after calling the 'setData' and 'setFullData' methods, and needs to listen to the 'node_tree_render_end' event calls 'fit'.")]),t("h3",[e._v("translateX(step)")]),t("p",[e._v("Translate in the "),t("code",[e._v("x")]),e._v(" direction, "),t("code",[e._v("step")]),e._v(": number of pixels to translate")]),t("h3",[e._v("translateY(step)")]),t("p",[e._v("Translate in the "),t("code",[e._v("y")]),e._v(" direction, "),t("code",[e._v("step")]),e._v(": number of pixels to translate")]),t("h3",[e._v("translateXTo(x)")]),t("blockquote",[t("p",[e._v("v0.2.11+")])]),t("p",[e._v("Translate the "),t("code",[e._v("x")]),e._v(" direction to a specific position")]),t("h3",[e._v("translateYTo(y)")]),t("blockquote",[t("p",[e._v("v0.2.11+")])]),t("p",[e._v("Translate the "),t("code",[e._v("y")]),e._v(" direction to a specific position")]),t("h3",[e._v("reset()")]),t("p",[e._v("Revert to the default transformation")]),t("h3",[e._v("narrow(cx, cy)")]),t("ul",[t("li",[t("p",[t("code",[e._v("cx")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])]),t("li",[t("p",[t("code",[e._v("cy")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])])]),t("p",[e._v("Zoom out")]),t("h3",[e._v("enlarge(cx, cy)")]),t("ul",[t("li",[t("p",[t("code",[e._v("cx")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])]),t("li",[t("p",[t("code",[e._v("cy")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])])]),t("p",[e._v("Zoom in")]),t("h3",[e._v("getTransformData()")]),t("blockquote",[t("p",[e._v("v0.1.1+")])]),t("p",[e._v("Get the current transform data, can be used for display")]),t("h3",[e._v("setTransformData(data)")]),t("blockquote",[t("p",[e._v("v0.1.1+")])]),t("p",[e._v('Dynamically set transform data, transform data can be obtained through the getTransformData method"')]),t("h3",[e._v("setScale(scale, cx, cy)")]),t("blockquote",[t("p",[e._v("v0.2.17+")])]),t("ul",[t("li",[t("p",[t("code",[e._v("cx")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])]),t("li",[t("p",[t("code",[e._v("cy")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])])]),t("p",[e._v("Setting Zoom")])])}],v={},i=v,c=o("2877"),s=Object(c["a"])(i,a,n,!1,null,null,null);t["default"]=s.exports}}]);
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0abe0f"],{"16c7":function(e,t,o){"use strict";o.r(t);var a=function(){var e=this;e._self._c;return e._m(0)},n=[function(){var e=this,t=e._self._c;return t("div",[t("h1",[e._v("View instance")]),t("p",[e._v("The "),t("code",[e._v("view")]),e._v(" instance is responsible for view operations, and can be obtained through "),t("code",[e._v("mindMap.view")])]),t("h2",[e._v("Methods")]),t("h3",[e._v("fit()")]),t("blockquote",[t("p",[e._v("v0.6.0+")])]),t("p",[e._v("Zoom the mind map to fit the canvas.")]),t("p",[e._v("Note that this method cannot be called immediately after calling the 'setData' and 'setFullData' methods, and needs to listen to the 'node_tree_render_end' event calls 'fit'.")]),t("h3",[e._v("translateX(step)")]),t("p",[e._v("Translate in the "),t("code",[e._v("x")]),e._v(" direction, "),t("code",[e._v("step")]),e._v(": number of pixels to translate")]),t("h3",[e._v("translateY(step)")]),t("p",[e._v("Translate in the "),t("code",[e._v("y")]),e._v(" direction, "),t("code",[e._v("step")]),e._v(": number of pixels to translate")]),t("h3",[e._v("translateXTo(x)")]),t("blockquote",[t("p",[e._v("v0.2.11+")])]),t("p",[e._v("Translate the "),t("code",[e._v("x")]),e._v(" direction to a specific position")]),t("h3",[e._v("translateYTo(y)")]),t("blockquote",[t("p",[e._v("v0.2.11+")])]),t("p",[e._v("Translate the "),t("code",[e._v("y")]),e._v(" direction to a specific position")]),t("h3",[e._v("reset()")]),t("p",[e._v("Revert to the default transformation")]),t("h3",[e._v("narrow(cx, cy)")]),t("ul",[t("li",[t("p",[t("code",[e._v("cx")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])]),t("li",[t("p",[t("code",[e._v("cy")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])])]),t("p",[e._v("Zoom out")]),t("h3",[e._v("enlarge(cx, cy)")]),t("ul",[t("li",[t("p",[t("code",[e._v("cx")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])]),t("li",[t("p",[t("code",[e._v("cy")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])])]),t("p",[e._v("Zoom in")]),t("h3",[e._v("getTransformData()")]),t("blockquote",[t("p",[e._v("v0.1.1+")])]),t("p",[e._v("Get the current transform data, can be used for display")]),t("h3",[e._v("setTransformData(data)")]),t("blockquote",[t("p",[e._v("v0.1.1+")])]),t("p",[e._v('Dynamically set transform data, transform data can be obtained through the getTransformData method"')]),t("h3",[e._v("setScale(scale, cx, cy)")]),t("blockquote",[t("p",[e._v("v0.2.17+")])]),t("ul",[t("li",[t("p",[t("code",[e._v("scale")]),e._v(": Scaling values, not scaled to '1', scaled to '1' for values less than, scaled to '1' for values greater than, scaled to '1' for values greater than")])]),t("li",[t("p",[t("code",[e._v("cx")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])]),t("li",[t("p",[t("code",[e._v("cy")]),e._v(":v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas")])])]),t("p",[e._v("Setting Zoom")])])}],v={},c=v,s=o("2877"),i=Object(s["a"])(c,a,n,!1,null,null,null);t["default"]=i.exports}}]);

1
dist/js/chunk-2d0ae956.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0db0f2"],{"6df4":function(v,_,e){"use strict";e.r(_);var n=function(){var v=this;v._self._c;return v._m(0)},o=[function(){var v=this,_=v._self._c;return _("div",[_("h1",[v._v("Command 实例")]),_("p",[_("code",[v._v("command")]),v._v("实例负责命令的添加及执行,内置了很多命令,也可以自行添加,命令指需要在历史堆栈数据里添加副本的操作。可通过"),_("code",[v._v("mindMap.command")]),v._v("获取到该实例")]),_("h2",[v._v("方法")]),_("h3",[v._v("pause()")]),_("blockquote",[_("p",[v._v("v0.9.11+")])]),_("p",[v._v("暂停收集历史数据。")]),_("h3",[v._v("recovery()")]),_("blockquote",[_("p",[v._v("v0.9.11+")])]),_("p",[v._v("恢复收集历史数据。")]),_("h3",[v._v("add(name, fn)")]),_("p",[v._v("添加命令。")]),_("p",[_("code",[v._v("name")]),v._v(":命令名称")]),_("p",[_("code",[v._v("fn")]),v._v(":命令要执行的方法")]),_("h3",[v._v("remove(name, fn)")]),_("p",[v._v("移除命令。")]),_("p",[_("code",[v._v("name")]),v._v(":要移除的命令名称")]),_("p",[_("code",[v._v("fn")]),v._v(":要移除的方法,不传的话移除该命令所有的方法")]),_("h3",[v._v("getCopyData()")]),_("p",[v._v("获取渲染树数据副本")]),_("h3",[v._v("clearHistory()")]),_("p",[v._v("清空历史堆栈数据")])])}],c={},p=c,a=e("2877"),d=Object(a["a"])(p,n,o,!1,null,null,null);_["default"]=d.exports}}]);
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0db0f2"],{"6df4":function(v,_,e){"use strict";e.r(_);var n=function(){var v=this;v._self._c;return v._m(0)},o=[function(){var v=this,_=v._self._c;return _("div",[_("h1",[v._v("Command 实例")]),_("p",[_("code",[v._v("command")]),v._v("实例负责命令的添加及执行,内置了很多命令,也可以自行添加,命令指需要在历史堆栈数据里添加副本的操作。可通过"),_("code",[v._v("mindMap.command")]),v._v("获取到该实例")]),_("h2",[v._v("属性")]),_("h3",[v._v("history")]),_("p",[v._v("当前所有的历史数据列表。不要手动修改该数组。")]),_("h3",[v._v("activeHistoryIndex")]),_("p",[v._v("当前所在的历史数据索引。不要手动修改该属性。")]),_("h2",[v._v("方法")]),_("p",[v._v("前进后退请使用命令"),_("code",[v._v("BACK")]),v._v("或"),_("code",[v._v("FORWARD")]),v._v("。")]),_("h3",[v._v("pause()")]),_("blockquote",[_("p",[v._v("v0.9.11+")])]),_("p",[v._v("暂停收集历史数据。")]),_("h3",[v._v("recovery()")]),_("blockquote",[_("p",[v._v("v0.9.11+")])]),_("p",[v._v("恢复收集历史数据。")]),_("h3",[v._v("add(name, fn)")]),_("p",[v._v("添加命令。")]),_("p",[_("code",[v._v("name")]),v._v(":命令名称")]),_("p",[_("code",[v._v("fn")]),v._v(":命令要执行的方法")]),_("h3",[v._v("remove(name, fn)")]),_("p",[v._v("移除命令。")]),_("p",[_("code",[v._v("name")]),v._v(":要移除的命令名称")]),_("p",[_("code",[v._v("fn")]),v._v(":要移除的方法,不传的话移除该命令所有的方法")]),_("h3",[v._v("getCopyData()")]),_("p",[v._v("获取渲染树数据副本。即当前画布的数据。")]),_("h3",[v._v("clearHistory()")]),_("p",[v._v("清空历史堆栈数据")])])}],c={},p=c,d=e("2877"),a=Object(d["a"])(p,n,o,!1,null,null,null);_["default"]=a.exports}}]);

View File

@@ -1 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0dddce"],{"82ca":function(v,_,e){"use strict";e.r(_);var c=function(){var v=this;v._self._c;return v._m(0)},t=[function(){var v=this,_=v._self._c;return _("div",[_("h1",[v._v("View实例")]),_("p",[_("code",[v._v("view")]),v._v("实例负责视图操作,可通过"),_("code",[v._v("mindMap.view")]),v._v("获取到该实例")]),_("h2",[v._v("方法")]),_("h3",[v._v("fit()")]),_("blockquote",[_("p",[v._v("v0.6.0+")])]),_("p",[v._v("缩放思维导图至适应画布。")]),_("p",[v._v("注意该方法不能在"),_("code",[v._v("setData")]),v._v("、"),_("code",[v._v("setFullData")]),v._v("方法调用后立即调用,需要监听"),_("code",[v._v("node_tree_render_end")]),v._v("事件调用"),_("code",[v._v("fit")]),v._v("。")]),_("h3",[v._v("translateX(step)")]),_("p",[_("code",[v._v("x")]),v._v("方向进行平移,"),_("code",[v._v("step")]),v._v(":要平移的像素")]),_("h3",[v._v("translateY(step)")]),_("p",[_("code",[v._v("y")]),v._v("方向进行平移,"),_("code",[v._v("step")]),v._v(":要平移的像素")]),_("h3",[v._v("translateXTo(x)")]),_("blockquote",[_("p",[v._v("v0.2.11+")])]),_("p",[v._v("平移"),_("code",[v._v("x")]),v._v("方向到指定位置")]),_("h3",[v._v("translateYTo(y)")]),_("blockquote",[_("p",[v._v("v0.2.11+")])]),_("p",[v._v("平移"),_("code",[v._v("y")]),v._v("方向到指定位置")]),_("h3",[v._v("reset()")]),_("p",[v._v("恢复到默认的变换")]),_("h3",[v._v("narrow(cx, cy)")]),_("ul",[_("li",[_("p",[_("code",[v._v("cx")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])]),_("li",[_("p",[_("code",[v._v("cy")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])])]),_("p",[v._v("缩小")]),_("h3",[v._v("enlarge(cx, cy)")]),_("ul",[_("li",[_("p",[_("code",[v._v("cx")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])]),_("li",[_("p",[_("code",[v._v("cy")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])])]),_("p",[v._v("放大")]),_("h3",[v._v("getTransformData()")]),_("blockquote",[_("p",[v._v("v0.1.1+")])]),_("p",[v._v("获取当前变换数据,可用于回显")]),_("h3",[v._v("setTransformData(data)")]),_("blockquote",[_("p",[v._v("v0.1.1+")])]),_("p",[v._v("动态设置变换数据可以通过getTransformData方法获取变换数据")]),_("h3",[v._v("setScale(scale, cx, cy)")]),_("blockquote",[_("p",[v._v("v0.2.17+")])]),_("ul",[_("li",[_("p",[_("code",[v._v("cx")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])]),_("li",[_("p",[_("code",[v._v("cy")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])])]),_("p",[v._v("设置缩放")])])}],o={},a=o,p=e("2877"),l=Object(p["a"])(a,c,t,!1,null,null,null);_["default"]=l.exports}}]);
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0dddce"],{"82ca":function(v,_,e){"use strict";e.r(_);var c=function(){var v=this;v._self._c;return v._m(0)},o=[function(){var v=this,_=v._self._c;return _("div",[_("h1",[v._v("View实例")]),_("p",[_("code",[v._v("view")]),v._v("实例负责视图操作,可通过"),_("code",[v._v("mindMap.view")]),v._v("获取到该实例")]),_("h2",[v._v("方法")]),_("h3",[v._v("fit()")]),_("blockquote",[_("p",[v._v("v0.6.0+")])]),_("p",[v._v("缩放思维导图至适应画布。")]),_("p",[v._v("注意该方法不能在"),_("code",[v._v("setData")]),v._v("、"),_("code",[v._v("setFullData")]),v._v("方法调用后立即调用,需要监听"),_("code",[v._v("node_tree_render_end")]),v._v("事件调用"),_("code",[v._v("fit")]),v._v("。")]),_("h3",[v._v("translateX(step)")]),_("p",[_("code",[v._v("x")]),v._v("方向进行平移,"),_("code",[v._v("step")]),v._v(":要平移的像素")]),_("h3",[v._v("translateY(step)")]),_("p",[_("code",[v._v("y")]),v._v("方向进行平移,"),_("code",[v._v("step")]),v._v(":要平移的像素")]),_("h3",[v._v("translateXTo(x)")]),_("blockquote",[_("p",[v._v("v0.2.11+")])]),_("p",[v._v("平移"),_("code",[v._v("x")]),v._v("方向到指定位置")]),_("h3",[v._v("translateYTo(y)")]),_("blockquote",[_("p",[v._v("v0.2.11+")])]),_("p",[v._v("平移"),_("code",[v._v("y")]),v._v("方向到指定位置")]),_("h3",[v._v("reset()")]),_("p",[v._v("恢复到默认的变换")]),_("h3",[v._v("narrow(cx, cy)")]),_("ul",[_("li",[_("p",[_("code",[v._v("cx")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])]),_("li",[_("p",[_("code",[v._v("cy")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])])]),_("p",[v._v("缩小")]),_("h3",[v._v("enlarge(cx, cy)")]),_("ul",[_("li",[_("p",[_("code",[v._v("cx")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])]),_("li",[_("p",[_("code",[v._v("cy")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])])]),_("p",[v._v("放大")]),_("h3",[v._v("getTransformData()")]),_("blockquote",[_("p",[v._v("v0.1.1+")])]),_("p",[v._v("获取当前变换数据,可用于回显")]),_("h3",[v._v("setTransformData(data)")]),_("blockquote",[_("p",[v._v("v0.1.1+")])]),_("p",[v._v("动态设置变换数据可以通过getTransformData方法获取变换数据")]),_("h3",[v._v("setScale(scale, cx, cy)")]),_("blockquote",[_("p",[v._v("v0.2.17+")])]),_("ul",[_("li",[_("p",[_("code",[v._v("scale")]),v._v(": 缩放数值,未缩放为"),_("code",[v._v("1")]),v._v(",小于为"),_("code",[v._v("1")]),v._v("缩小,大于"),_("code",[v._v("1")]),v._v("为放大")])]),_("li",[_("p",[_("code",[v._v("cx")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])]),_("li",[_("p",[_("code",[v._v("cy")]),v._v("v0.6.4+)以画布指定位置进行缩放,默认为画布中心点")])])]),_("p",[v._v("设置缩放")])])}],t={},a=t,p=e("2877"),d=Object(p["a"])(a,c,o,!1,null,null,null);_["default"]=d.exports}}]);

View File

@@ -1 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e5089"],{9381:function(e,o,a){"use strict";a.r(o);var n=function(){var e=this;e._self._c;return e._m(0)},t=[function(){var e=this,o=e._self._c;return o("div",[o("h1",[e._v("command instance")]),o("p",[e._v("The "),o("code",[e._v("command")]),e._v(" instance is responsible for adding and executing commands. It includes many built-in commands and can also be added manually. A command refers to an operation that needs to add a copy to the history stack data. The "),o("code",[e._v("mindMap.command")]),e._v(' instance can be obtained through this."')]),o("h2",[e._v("Methods")]),o("h3",[e._v("pause()")]),o("blockquote",[o("p",[e._v("v0.9.11+")])]),o("p",[e._v("Pause collecting historical data.")]),o("h3",[e._v("recovery()")]),o("blockquote",[o("p",[e._v("v0.9.11+")])]),o("p",[e._v("Restore the collection of historical data.")]),o("h3",[e._v("add(name, fn)")]),o("p",[e._v("Add a command.")]),o("p",[o("code",[e._v("name")]),e._v(": Command name")]),o("p",[o("code",[e._v("fn")]),e._v(": Method to be executed by the command")]),o("h3",[e._v("remove(name, fn)")]),o("p",[e._v("Remove a command.")]),o("p",[o("code",[e._v("name")]),e._v(": Name of the command to be removed")]),o("p",[o("code",[e._v("fn")]),e._v(": Method to be removed, if not provided all methods for the command will be removed")]),o("h3",[e._v("getCopyData()")]),o("p",[e._v("Get a copy of the rendering tree data")]),o("h3",[e._v("clearHistory()")]),o("p",[e._v("Clear the history stack data")])])}],d={},c=d,v=a("2877"),m=Object(v["a"])(c,n,t,!1,null,null,null);o["default"]=m.exports}}]);
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e5089"],{9381:function(e,a,o){"use strict";o.r(a);var t=function(){var e=this;e._self._c;return e._m(0)},n=[function(){var e=this,a=e._self._c;return a("div",[a("h1",[e._v("command instance")]),a("p",[e._v("The "),a("code",[e._v("command")]),e._v(" instance is responsible for adding and executing commands. It includes many built-in commands and can also be added manually. A command refers to an operation that needs to add a copy to the history stack data. The "),a("code",[e._v("mindMap.command")]),e._v(' instance can be obtained through this."')]),a("h2",[e._v("Props")]),a("h3",[e._v("history")]),a("p",[e._v("The current list of all historical data. Do not manually modify the array.")]),a("h3",[e._v("activeHistoryIndex")]),a("p",[e._v("The current historical data index. Do not manually modify this property.")]),a("h2",[e._v("Methods")]),a("p",[e._v("Please use the command 'Back' or 'FORWARD' to move forward or backward.")]),a("h3",[e._v("pause()")]),a("blockquote",[a("p",[e._v("v0.9.11+")])]),a("p",[e._v("Pause collecting historical data.")]),a("h3",[e._v("recovery()")]),a("blockquote",[a("p",[e._v("v0.9.11+")])]),a("p",[e._v("Restore the collection of historical data.")]),a("h3",[e._v("add(name, fn)")]),a("p",[e._v("Add a command.")]),a("p",[a("code",[e._v("name")]),e._v(": Command name")]),a("p",[a("code",[e._v("fn")]),e._v(": Method to be executed by the command")]),a("h3",[e._v("remove(name, fn)")]),a("p",[e._v("Remove a command.")]),a("p",[a("code",[e._v("name")]),e._v(": Name of the command to be removed")]),a("p",[a("code",[e._v("fn")]),e._v(": Method to be removed, if not provided all methods for the command will be removed")]),a("h3",[e._v("getCopyData()")]),a("p",[e._v("Get a copy of the rendering tree data. That is, the data of the current canvas.")]),a("h3",[e._v("clearHistory()")]),a("p",[e._v("Clear the history stack data")])])}],d={},c=d,r=o("2877"),v=Object(r["a"])(c,t,n,!1,null,null,null);a["default"]=v.exports}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
dist/js/chunk-2d21e7f1.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
dist/js/chunk-428b560e.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
dist/js/chunk-6fd88c2d.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@
id: 'KRO0WxK8GT66tYCQ',
ck: 'KRO0WxK8GT66tYCQ',
autoTrack: false
})</script><link href="dist/css/chunk-vendors.css?b34a2f0278e7d1ccab6a" rel="stylesheet"><link href="dist/css/app.css?b34a2f0278e7d1ccab6a" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script>const getDataFromBackend = () => {
})</script><link href="dist/css/chunk-vendors.css?dd8fa3cd99060d550179" rel="stylesheet"><link href="dist/css/app.css?dd8fa3cd99060d550179" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script>const getDataFromBackend = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
@@ -70,4 +70,4 @@
// 可以通过window.$bus.$on()来监听应用的一些事件
// 实例化页面
window.initApp()
}</script><script src="dist/js/chunk-vendors.js?b34a2f0278e7d1ccab6a"></script><script src="dist/js/app.js?b34a2f0278e7d1ccab6a"></script></body></html>
}</script><script src="dist/js/chunk-vendors.js?dd8fa3cd99060d550179"></script><script src="dist/js/app.js?dd8fa3cd99060d550179"></script></body></html>

View File

@@ -17,6 +17,7 @@ import Scrollbar from './src/plugins/Scrollbar.js'
import Formula from './src/plugins/Formula.js'
import RainbowLines from './src/plugins/RainbowLines.js'
import Demonstrate from './src/plugins/Demonstrate.js'
import OuterFrame from './src/plugins/OuterFrame.js'
import xmind from './src/parse/xmind.js'
import markdown from './src/parse/markdown.js'
import icons from './src/svg/icons.js'
@@ -30,7 +31,7 @@ MindMap.iconList = icons.nodeIconList
MindMap.constants = constants
MindMap.themes = themes
MindMap.defaultTheme = defaultTheme
MindMap.version = '0.10.0'
MindMap.version = '0.10.2'
MindMap.usePlugin(MiniMap)
.usePlugin(Watermark)
@@ -50,5 +51,6 @@ MindMap.usePlugin(MiniMap)
.usePlugin(Formula)
.usePlugin(RainbowLines)
.usePlugin(Demonstrate)
.usePlugin(OuterFrame)
export default MindMap

View File

@@ -518,7 +518,6 @@ class MindMap {
// 恢复原先的大小和变换信息
svg.size(origWidth, origHeight)
draw.transform(origTransform)
return {
svg: clone, // 思维导图图形的整体svg元素包括svg画布容器、g实际的思维导图组
svgHTML: clone.svg(), // svg字符串

View File

@@ -1,11 +1,11 @@
{
"name": "simple-mind-map",
"version": "0.9.8",
"version": "0.10.0-fix.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.9.8",
"version": "0.10.0-fix.1",
"license": "MIT",
"dependencies": {
"@svgdotjs/svg.js": "^3.0.16",

View File

@@ -1,6 +1,6 @@
{
"name": "simple-mind-map",
"version": "0.10.0",
"version": "0.10.2",
"description": "一个简单的web在线思维导图",
"authors": [
{

View File

@@ -174,6 +174,7 @@ export const CONSTANTS = {
},
LAYOUT: {
LOGICAL_STRUCTURE: 'logicalStructure',
LOGICAL_STRUCTURE_LEFT: 'logicalStructureLeft',
MIND_MAP: 'mindMap',
ORGANIZATION_STRUCTURE: 'organizationStructure',
CATALOG_ORGANIZATION: 'catalogOrganization',
@@ -251,6 +252,10 @@ export const layoutList = [
name: '逻辑结构图',
value: CONSTANTS.LAYOUT.LOGICAL_STRUCTURE
},
{
name: '向左逻辑结构图',
value: CONSTANTS.LAYOUT.LOGICAL_STRUCTURE_LEFT
},
{
name: '思维导图',
value: CONSTANTS.LAYOUT.MIND_MAP
@@ -282,6 +287,7 @@ export const layoutList = [
]
export const layoutValueList = [
CONSTANTS.LAYOUT.LOGICAL_STRUCTURE,
CONSTANTS.LAYOUT.LOGICAL_STRUCTURE_LEFT,
CONSTANTS.LAYOUT.MIND_MAP,
CONSTANTS.LAYOUT.CATALOG_ORGANIZATION,
CONSTANTS.LAYOUT.ORGANIZATION_STRUCTURE,
@@ -314,7 +320,9 @@ export const nodeDataNoStylePropList = [
'associativeLinePoint',
'associativeLineText',
'attachmentUrl',
'attachmentName'
'attachmentName',
'notation',
'outerFrame'
]
// 错误类型

View File

@@ -215,11 +215,17 @@ export const defaultOpt = {
// 函数接收两个参数key快捷键、activeNodeList当前激活的节点列表
beforeShortcutRun: null,
// 移动节点到画布中心、回到根节点等操作时是否将缩放层级复位为100%
// 该选项实际影响的是render.moveNodeToCenter方法moveNodeToCenter方法本身也存在第二个参数resetScale来设置是否复位如果resetScale参数没有传递那么使用resetScaleOnMoveNodeToCenter配置否则使用resetScale配置
resetScaleOnMoveNodeToCenter: false,
// 添加附加的节点前置内容,前置内容指和文本同一行的区域中的前置内容,不包括节点图片部分
createNodePrefixContent: null,
// 添加附加的节点后置内容,后置内容指和文本同一行的区域中的后置内容,不包括节点图片部分
createNodePostfixContent: null,
// 禁止粘贴用户剪贴板中的数据,禁止将复制的数据写入用户的剪贴板中
disabledClipboard: false,
// 自定义超链接的跳转
// 如果不传默认会以新窗口的方式打开超链接可以传递一个函数函数接收两个参数link超链接的url、node所属节点实例只要传递了函数就会阻止默认的跳转
customHyperlinkJump: null,
// 【Select插件】
// 多选节点时鼠标移动到边缘时的画布移动偏移量
@@ -250,6 +256,13 @@ export const defaultOpt = {
cloneNodeOpacity: 0.5, // 跟随鼠标移动的克隆节点或矩形的透明度
beingDragNodeOpacity: 0.3 // 被拖拽节点的透明度
},
// 拖拽单个节点时会克隆被拖拽节点,如果想修改该克隆节点,那么可以通过该选项提供一个处理函数,函数接收克隆节点对象
// 需要注意的是节点对象指的是@svgdotjs/svg.js库的元素对象所以你需要阅读该库的文档来操作该对象
handleDragCloneNode: null,
// 即将拖拽完成前调用该函数,函数接收一个对象作为参数:{overlapNodeUid,prevNodeUid,nextNodeUid}代表拖拽信息如果要阻止本次拖拽那么可以返回true此时node_dragend事件不会再触发。函数可以是异步函数返回Promise实例
beforeDragEnd: null,
// 即将开始调整节点前调用该函数函数接收当前即将被拖拽的节点实例列表作为参数如果要阻止本次拖拽那么可以返回true
beforeDragStart: null,
// 【Watermark插件】
// 水印配置
@@ -293,6 +306,9 @@ export const defaultOpt = {
*/
addContentToHeader: null,
addContentToFooter: null,
// 导出png、svg、pdf时会获取画布上的svg数据进行克隆然后通过该克隆的元素进行导出如果你想对该克隆元素做一些处理比如新增、替换、修改其中的一些元素那么可以通过该参数传递一个处理函数接收svg元素对象处理后需要返回原svg元素对象。
// 需要注意的是svg对象指的是@svgdotjs/svg.js库的元素对象所以你需要阅读该库的文档来操作该对象
handleBeingExportSvg: null,
// 【AssociativeLine插件】
// 关联线默认文字
@@ -314,6 +330,10 @@ export const defaultOpt = {
// 禁止双指缩放你仍旧可以使用api进行缩放
// 需要注册TouchEvent插件后生效
disableTouchZoom: false,
// 允许最大和最小的缩放值,百分数
// 传-1代表不限制
minTouchZoomScale: 20,
maxTouchZoomScale: -1,
// 【Scrollbar插件】
// 当注册了滚动条插件Scrollbar是否将思维导图限制在画布内isLimitMindMapInCanvas不再起作用
@@ -367,5 +387,5 @@ export const defaultOpt = {
beforeHideRichTextEdit: null,
// 设置富文本节点编辑框和节点大小一致,形成伪原地编辑的效果
// 需要注意的是,只有当节点内只有文本、且形状是矩形才会有比较好的效果
richTextEditFakeInPlace: false,
richTextEditFakeInPlace: false
}

View File

@@ -99,6 +99,7 @@ class Event extends EventEmitter {
// 鼠标按下事件
onMousedown(e) {
e.preventDefault()
// 鼠标左键
if (e.which === 1) {
this.isLeftMousedown = true
@@ -114,6 +115,7 @@ class Event extends EventEmitter {
// 鼠标移动事件
onMousemove(e) {
e.preventDefault()
let { useLeftKeySelectionRightKeyDrag } = this.mindMap.opt
this.mousemovePos.x = e.clientX
this.mousemovePos.y = e.clientY

View File

@@ -42,6 +42,8 @@ import { Polygon } from '@svgdotjs/svg.js'
const layouts = {
// 逻辑结构图
[CONSTANTS.LAYOUT.LOGICAL_STRUCTURE]: LogicalStructure,
// 向左逻辑结构图
[CONSTANTS.LAYOUT.LOGICAL_STRUCTURE_LEFT]: LogicalStructure,
// 思维导图
[CONSTANTS.LAYOUT.MIND_MAP]: MindMap,
// 目录组织图
@@ -466,7 +468,6 @@ class Render {
// 渲染节点
this.root.render(() => {
this.isRendering = false
this.mindMap.emit('node_tree_render_end')
callback && callback()
if (this.hasWaitRendering) {
const params = this.waitRenderingParams
@@ -486,6 +487,7 @@ class Render {
this.mindMap.command.addHistory()
}
}
this.mindMap.emit('node_tree_render_end')
})
})
this.emitNodeActiveEvent()
@@ -1013,14 +1015,18 @@ class Render {
copy() {
this.beingCopyData = this.copyNode()
if (!this.beingCopyData) return
setDataToClipboard(createSmmFormatData(this.beingCopyData))
if (!this.mindMap.opt.disabledClipboard) {
setDataToClipboard(createSmmFormatData(this.beingCopyData))
}
}
// 剪切节点
cut() {
this.mindMap.execCommand('CUT_NODE', copyData => {
this.beingCopyData = copyData
setDataToClipboard(createSmmFormatData(copyData))
if (!this.mindMap.opt.disabledClipboard) {
setDataToClipboard(createSmmFormatData(copyData))
}
})
}
@@ -1029,17 +1035,20 @@ class Render {
const {
errorHandler,
handleIsSplitByWrapOnPasteCreateNewNode,
handleNodePasteImg
handleNodePasteImg,
disabledClipboard
} = this.mindMap.opt
// 读取剪贴板的文字和图片
let text = null
let text = ''
let img = null
try {
const res = await getDataFromClipboard()
text = res.text
img = res.img
} catch (error) {
errorHandler(ERROR_TYPES.READ_CLIPBOARD_ERROR, error)
if (!disabledClipboard) {
try {
const res = await getDataFromClipboard()
text = res.text || ''
img = res.img || null
} catch (error) {
errorHandler(ERROR_TYPES.READ_CLIPBOARD_ERROR, error)
}
}
// 检查剪切板数据是否有变化
// 通过图片大小来判断图片是否发生变化,可能是不准确的,但是目前没有其他好方法
@@ -1553,7 +1562,7 @@ class Render {
// 切换激活节点的展开状态
toggleActiveExpand() {
this.activeNodeList.forEach(node => {
if (node.nodeData.children.length <= 0) {
if (node.nodeData.children.length <= 0 || node.isRoot) {
return
}
this.toggleNodeExpand(node)
@@ -1799,9 +1808,13 @@ class Render {
}
}
// 移动节点到画布中心
moveNodeToCenter(node) {
const { resetScaleOnMoveNodeToCenter } = this.mindMap.opt
// 移动节点到画布中心
// resetScale参数指定是否要将画布缩放值复位为100%当你没有显式传递时默认值为undefined因为实例化选项的resetScaleOnMoveNodeToCenter配置也会决定是否复位缩放所以当你没有显式传递时使用resetScaleOnMoveNodeToCenter配置否则使用resetScale配置
moveNodeToCenter(node, resetScale) {
let { resetScaleOnMoveNodeToCenter } = this.mindMap.opt
if (resetScale !== undefined) {
resetScaleOnMoveNodeToCenter = resetScale
}
let { transform, state } = this.mindMap.view.getTransformData()
let { left, top, width, height } = node
if (!resetScaleOnMoveNodeToCenter) {

View File

@@ -286,7 +286,6 @@ export default class TextEdit {
// 隐藏文本编辑框
hideEditTextBox() {
this.currentNode = null
if (this.mindMap.richText) {
return this.mindMap.richText.hideEditText()
}
@@ -305,8 +304,10 @@ export default class TextEdit {
this.mindMap.emit(
'hide_text_edit',
this.textEditNode,
this.renderer.activeNodeList
this.renderer.activeNodeList,
this.currentNode
)
this.currentNode = null
this.textEditNode.style.display = 'none'
this.textEditNode.innerHTML = ''
this.textEditNode.style.fontFamily = 'inherit'

View File

@@ -427,7 +427,7 @@ class Node {
;(this._textData.nodeContent || this._textData.node)
.x(-oldX) // 修复非富文本模式下同时存在图标和换行的文本时,被收起和展开时图标与文字距离会逐渐拉大的问题
.x(textContentOffsetX)
.y(0)
.y((this._rectInfo.textContentHeight - this._textData.height) / 2)
textContentNested.add(this._textData.node)
textContentOffsetX += this._textData.width + textContentItemMargin
}
@@ -493,6 +493,7 @@ class Node {
)
this.group.add(textContentNested)
addHoverNode()
this.mindMap.emit('node_layout_end', this)
}
// 给节点绑定事件
@@ -514,6 +515,7 @@ class Node {
this.active(e)
})
this.group.on('mousedown', e => {
e.preventDefault()
const {
readonly,
enableCtrlKeyNodeSelection,
@@ -756,7 +758,9 @@ class Node {
this.layout()
this.update()
} else {
this.nodeDraw.add(this.group)
if (!this.nodeDraw.has(this.group)) {
this.nodeDraw.add(this.group)
}
if (this.needLayout) {
this.needLayout = false
this.layout()

View File

@@ -254,12 +254,16 @@ function createHyperlinkNode() {
if (!hyperlink) {
return
}
const { customHyperlinkJump } = this.mindMap.opt
let iconSize = this.mindMap.themeConfig.iconSize
let node = new SVG().size(iconSize, iconSize)
// 超链接节点
let a = new A().to(hyperlink).target('_blank')
a.node.addEventListener('click', e => {
e.stopPropagation()
if (typeof customHyperlinkJump === 'function') {
e.preventDefault()
customHyperlinkJump(hyperlink, this)
}
})
if (hyperlinkTitle) {
node.add(SVG(`<title>${hyperlinkTitle}</title>`))

View File

@@ -1,11 +1,13 @@
import Base from './Base'
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
import { CONSTANTS } from '../constants/constant'
// 逻辑结构图
class LogicalStructure extends Base {
// 构造函数
constructor(opt = {}) {
constructor(opt = {}, layout) {
super(opt)
this.isUseLeft = layout === CONSTANTS.LAYOUT.LOGICAL_STRUCTURE_LEFT
}
// 布局
@@ -40,8 +42,15 @@ class LogicalStructure extends Base {
} else {
// 非根节点
// 定位到父节点右侧
newNode.left =
parent._node.left + parent._node.width + this.getMarginX(layerIndex)
if (this.isUseLeft) {
newNode.left =
parent._node.left - newNode.width - this.getMarginX(layerIndex)
} else {
newNode.left =
parent._node.left +
parent._node.width +
this.getMarginX(layerIndex)
}
}
if (!cur.data.expand) {
return true
@@ -167,15 +176,24 @@ class LogicalStructure extends Base {
}
let marginX = this.getMarginX(node.layerIndex + 1)
let s1 = (marginX - expandBtnSize) * 0.6
if (this.isUseLeft) {
s1 *= -1
}
let nodeUseLineStyle = this.mindMap.themeConfig.nodeUseLineStyle
node.children.forEach((item, index) => {
let x1 =
node.layerIndex === 0 ? left + width : left + width + expandBtnSize
let x1
if (this.isUseLeft) {
x1 = node.layerIndex === 0 ? left : left - expandBtnSize
} else {
x1 = node.layerIndex === 0 ? left + width : left + width + expandBtnSize
}
let y1 = top + height / 2
let x2 = item.left
let x2 = this.isUseLeft ? item.left + item.width : item.left
let y2 = item.top + item.height / 2
// 节点使用横线风格,需要额外渲染横线
let nodeUseLineStyleOffset = nodeUseLineStyle ? item.width : 0
let nodeUseLineStyleOffset = nodeUseLineStyle
? item.width * (this.isUseLeft ? -1 : 1)
: 0
y1 = nodeUseLineStyle && !node.isRoot ? y1 + height / 2 : y1
y2 = nodeUseLineStyle ? y2 + item.height / 2 : y2
let path = this.createFoldLine([
@@ -202,15 +220,17 @@ class LogicalStructure extends Base {
if (node.layerIndex === 0) {
expandBtnSize = 0
}
let x1 = left + width + expandBtnSize
let x1 = this.isUseLeft
? left - expandBtnSize
: left + width + expandBtnSize
let y1 = top + height / 2
let x2 = item.left
let x2 = this.isUseLeft ? item.left + item.width : item.left
let y2 = item.top + item.height / 2
y1 = nodeUseLineStyle && !node.isRoot ? y1 + height / 2 : y1
y2 = nodeUseLineStyle ? y2 + item.height / 2 : y2
// 节点使用横线风格,需要额外渲染横线
let nodeUseLineStylePath = nodeUseLineStyle
? ` L ${item.left + item.width},${y2}`
? ` L ${this.isUseLeft ? item.left : item.left + item.width},${y2}`
: ''
let path = `M ${x1},${y1} L ${x2},${y2}` + nodeUseLineStylePath
this.setLineStyle(style, lines[index], path, item)
@@ -235,20 +255,33 @@ class LogicalStructure extends Base {
if (node.layerIndex === 0) {
expandBtnSize = 0
}
let x1 =
node.layerIndex === 0 && !rootLineStartPositionKeepSameInCurve
? left + width / 2
: left + width + expandBtnSize
let x1
if (this.isUseLeft) {
x1 =
node.layerIndex === 0 && !rootLineStartPositionKeepSameInCurve
? left + width / 2
: left - expandBtnSize
} else {
x1 =
node.layerIndex === 0 && !rootLineStartPositionKeepSameInCurve
? left + width / 2
: left + width + expandBtnSize
}
let y1 = top + height / 2
let x2 = item.left
let x2 = this.isUseLeft ? item.left + item.width : item.left
let y2 = item.top + item.height / 2
let path = ''
y1 = nodeUseLineStyle && !node.isRoot ? y1 + height / 2 : y1
y2 = nodeUseLineStyle ? y2 + item.height / 2 : y2
// 节点使用横线风格,需要额外渲染横线
let nodeUseLineStylePath = nodeUseLineStyle
? ` L ${item.left + item.width},${y2}`
: ''
let nodeUseLineStylePath
if (this.isUseLeft) {
nodeUseLineStylePath = nodeUseLineStyle ? ` L ${item.left},${y2}` : ''
} else {
nodeUseLineStylePath = nodeUseLineStyle
? ` L ${item.left + item.width},${y2}`
: ''
}
if (node.isRoot && !rootLineKeepSameInCurve) {
path = this.quadraticCurvePath(x1, y1, x2, y2) + nodeUseLineStylePath
} else {
@@ -260,14 +293,17 @@ class LogicalStructure extends Base {
// 渲染按钮
renderExpandBtn(node, btn) {
let { width, height } = node
let { width, height, expandBtnSize, layerIndex } = node
if (layerIndex === 0) {
expandBtnSize = 0
}
let { translateX, translateY } = btn.transform()
// 节点使用横线风格,需要调整展开收起按钮位置
let nodeUseLineStyleOffset = this.mindMap.themeConfig.nodeUseLineStyle
? height / 2
: 0
// 位置没有变化则返回
let _x = width
let _x = this.isUseLeft ? 0 - expandBtnSize : width
let _y = height / 2 + nodeUseLineStyleOffset
if (_x === translateX && _y === translateY) {
return
@@ -279,29 +315,42 @@ class LogicalStructure extends Base {
renderGeneralization(list) {
list.forEach(item => {
let {
left,
top,
bottom,
right,
generalizationLineMargin,
generalizationNodeMargin
} = this.getNodeGeneralizationRenderBoundaries(item, 'h')
let x1 = right + generalizationLineMargin
let x = this.isUseLeft
? left - generalizationLineMargin
: right + generalizationLineMargin
let x1 = x
let y1 = top
let x2 = right + generalizationLineMargin
let x2 = x
let y2 = bottom
let cx = x1 + 20
let cx = x1 + (this.isUseLeft ? -20 : 20)
let cy = y1 + (y2 - y1) / 2
let path = `M ${x1},${y1} Q ${cx},${cy} ${x2},${y2}`
item.generalizationLine.plot(path)
item.generalizationNode.left = right + generalizationNodeMargin
item.generalizationNode.left =
x +
(this.isUseLeft
? -generalizationNodeMargin
: generalizationNodeMargin) -
(this.isUseLeft ? item.generalizationNode.width : 0)
item.generalizationNode.top =
top + (bottom - top - item.generalizationNode.height) / 2
})
}
// 渲染展开收起按钮的隐藏占位元素
renderExpandBtnRect(rect, expandBtnSize, width, height, node) {
rect.size(expandBtnSize, height).x(width).y(0)
renderExpandBtnRect(rect, expandBtnSize, width, height) {
if (this.isUseLeft) {
rect.size(expandBtnSize, height).x(-expandBtnSize).y(0)
} else {
rect.size(expandBtnSize, height).x(width).y(0)
}
}
}

View File

@@ -6,6 +6,7 @@ import {
} from '../utils'
import Base from '../layouts/Base'
import { CONSTANTS } from '../constants/constant'
import AutoMove from '../utils/AutoMove'
// 节点拖动插件
class Drag extends Base {
@@ -13,13 +14,14 @@ class Drag extends Base {
constructor({ mindMap }) {
super(mindMap.renderer)
this.mindMap = mindMap
this.autoMove = new AutoMove(mindMap)
this.reset()
this.bindEvent()
}
// 复位
reset() {
// 是否正在跳转
// 是否正在拖拽
this.isDragging = false
// 鼠标按下的节点
this.mousedownNode = null
@@ -123,13 +125,15 @@ class Drag extends Base {
}
// 鼠标松开事件
onMouseup(e) {
async onMouseup(e) {
if (!this.isMousedown) {
return
}
const { autoMoveWhenMouseInEdgeOnDrag, enableFreeDrag, beforeDragEnd } =
this.mindMap.opt
// 停止自动移动
if (this.mindMap.opt.autoMoveWhenMouseInEdgeOnDrag && this.mindMap.select) {
this.mindMap.select.clearAutoMoveTimer()
if (autoMoveWhenMouseInEdgeOnDrag && this.mindMap.select) {
this.autoMove.clearAutoMoveTimer()
}
this.isMousedown = false
// 恢复被拖拽节点的临时设置
@@ -142,9 +146,21 @@ class Drag extends Base {
let overlapNodeUid = this.overlapNode ? this.overlapNode.getData('uid') : ''
let prevNodeUid = this.prevNode ? this.prevNode.getData('uid') : ''
let nextNodeUid = this.nextNode ? this.nextNode.getData('uid') : ''
if (this.isDragging && typeof beforeDragEnd === 'function') {
const isCancel = await beforeDragEnd({
overlapNodeUid,
prevNodeUid,
nextNodeUid,
beingDragNodeList: [...this.beingDragNodeList]
})
if (isCancel) {
this.reset()
return
}
}
// 存在重叠子节点,则移动作为其子节点
if (this.overlapNode) {
this.mindMap.execCommand('SET_NODE_ACTIVE', this.overlapNode, false)
this.removeNodeActive(this.overlapNode)
this.mindMap.execCommand(
'MOVE_NODE_TO',
this.beingDragNodeList,
@@ -152,7 +168,7 @@ class Drag extends Base {
)
} else if (this.prevNode) {
// 存在前一个相邻节点,作为其下一个兄弟节点
this.mindMap.execCommand('SET_NODE_ACTIVE', this.prevNode, false)
this.removeNodeActive(this.prevNode)
this.mindMap.execCommand(
'INSERT_AFTER',
this.beingDragNodeList,
@@ -160,7 +176,7 @@ class Drag extends Base {
)
} else if (this.nextNode) {
// 存在下一个相邻节点,作为其前一个兄弟节点
this.mindMap.execCommand('SET_NODE_ACTIVE', this.nextNode, false)
this.removeNodeActive(this.nextNode)
this.mindMap.execCommand(
'INSERT_BEFORE',
this.beingDragNodeList,
@@ -168,7 +184,7 @@ class Drag extends Base {
)
} else if (
this.clone &&
this.mindMap.opt.enableFreeDrag &&
enableFreeDrag &&
this.beingDragNodeList.length === 1
) {
// 如果只拖拽了一个节点,那么设置自定义位置
@@ -201,9 +217,16 @@ class Drag extends Base {
this.reset()
}
// 移除节点的激活状态
removeNodeActive(node) {
if (node.getData('isActive')) {
this.mindMap.execCommand('SET_NODE_ACTIVE', node, false)
}
}
// 拖动中
onMove(x, y, e) {
if (!this.isMousedown) {
if (!this.isMousedown || !this.isDragging) {
return
}
// 更新克隆节点的位置
@@ -216,18 +239,15 @@ class Drag extends Base {
this.clone.translate(x - t.translateX, y - t.translateY)
// 检测新位置
this.checkOverlapNode()
// 如果注册了多选节点插件,那么复用它的边缘自动移动画布功能
if (this.mindMap.opt.autoMoveWhenMouseInEdgeOnDrag && this.mindMap.select) {
this.drawTransform = this.mindMap.draw.transform()
this.mindMap.select.clearAutoMoveTimer()
this.mindMap.select.onMove(e.clientX, e.clientY)
}
// 边缘自动移动画布
this.drawTransform = this.mindMap.draw.transform()
this.autoMove.clearAutoMoveTimer()
this.autoMove.onMove(e.clientX, e.clientY)
}
// 开始拖拽时初始化一些数据
handleStartMove() {
async handleStartMove() {
if (!this.isDragging) {
this.isDragging = true
// 鼠标按下的节点
let node = this.mousedownNode
// 计算鼠标按下的位置距离节点左上角的距离
@@ -248,12 +268,19 @@ class Drag extends Base {
// 否则只拖拽按下的节点
this.beingDragNodeList = [node]
}
// 拦截拖拽
const { beforeDragStart } = this.mindMap.opt
if (typeof beforeDragStart === 'function') {
const stop = await beforeDragStart([...this.beingDragNodeList])
if (stop) return
}
// 将节点树转为节点数组
this.nodeTreeToList()
// 创建克隆节点
this.createCloneNode()
// 清除当前所有激活的节点
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
this.isDragging = true
}
}
@@ -282,7 +309,8 @@ class Drag extends Base {
dragMultiNodeRectConfig,
dragPlaceholderRectFill,
dragPlaceholderLineConfig,
dragOpacityConfig
dragOpacityConfig,
handleDragCloneNode
} = this.mindMap.opt
const {
width: rectWidth,
@@ -311,6 +339,9 @@ class Drag extends Base {
expandEl.remove()
}
this.mindMap.otherDraw.add(this.clone)
if (typeof handleDragCloneNode === 'function') {
handleDragCloneNode(this.clone)
}
}
this.clone.opacity(dragOpacityConfig.cloneNodeOpacity)
this.clone.css('z-index', 99999)
@@ -366,6 +397,7 @@ class Drag extends Base {
}
const {
LOGICAL_STRUCTURE,
LOGICAL_STRUCTURE_LEFT,
MIND_MAP,
ORGANIZATION_STRUCTURE,
CATALOG_ORGANIZATION,
@@ -389,6 +421,7 @@ class Drag extends Base {
}
switch (this.mindMap.opt.layout) {
case LOGICAL_STRUCTURE:
case LOGICAL_STRUCTURE_LEFT:
this.handleLogicalStructure(node)
break
case MIND_MAP:
@@ -426,6 +459,7 @@ class Drag extends Base {
handleOverlapNode() {
const {
LOGICAL_STRUCTURE,
LOGICAL_STRUCTURE_LEFT,
MIND_MAP,
ORGANIZATION_STRUCTURE,
CATALOG_ORGANIZATION,
@@ -460,6 +494,10 @@ class Drag extends Base {
: lastNodeRect.originLeft
y = lastNodeRect.originBottom + this.minOffset - halfPlaceholderHeight
break
case LOGICAL_STRUCTURE_LEFT:
x = lastNodeRect.originRight - this.placeholderWidth
y = lastNodeRect.originBottom + this.minOffset - halfPlaceholderHeight
break
case ORGANIZATION_STRUCTURE:
rotate = true
x = lastNodeRect.originRight + this.minOffset - halfPlaceholderHeight
@@ -572,6 +610,12 @@ class Drag extends Base {
nodeRect.originTop +
(nodeRect.originHeight - this.placeholderHeight) / 2
break
case LOGICAL_STRUCTURE_LEFT:
x = nodeRect.originLeft - this.placeholderWidth - marginX
y =
nodeRect.originTop +
(nodeRect.originHeight - this.placeholderHeight) / 2
break
case ORGANIZATION_STRUCTURE:
rotate = true
x =
@@ -652,6 +696,7 @@ class Drag extends Base {
getNewChildNodeDir(node) {
const {
LOGICAL_STRUCTURE,
LOGICAL_STRUCTURE_LEFT,
MIND_MAP,
TIMELINE2,
VERTICAL_TIMELINE,
@@ -660,6 +705,8 @@ class Drag extends Base {
switch (this.mindMap.opt.layout) {
case LOGICAL_STRUCTURE:
return CONSTANTS.LAYOUT_GROW_DIR.RIGHT
case LOGICAL_STRUCTURE_LEFT:
return CONSTANTS.LAYOUT_GROW_DIR.LEFT
case MIND_MAP:
case TIMELINE2:
case VERTICAL_TIMELINE:

View File

@@ -54,7 +54,8 @@ class Export {
errorHandler,
resetCss,
addContentToHeader,
addContentToFooter
addContentToFooter,
handleBeingExportSvg
} = this.mindMap.opt
let { svg, svgHTML, clipData } = this.mindMap.getSvgData({
paddingX: exportPaddingX,
@@ -67,6 +68,7 @@ class Export {
clipData.paddingX = exportPaddingX
clipData.paddingY = exportPaddingY
}
let svgIsChange = false
// svg的image标签把图片的url转换成data:url类型否则导出会丢失图片
const task1 = this.createTransformImgTaskList(
svg,
@@ -87,16 +89,20 @@ class Export {
errorHandler(ERROR_TYPES.EXPORT_LOAD_IMAGE_ERROR, error)
}
// 开启了节点富文本编辑,需要增加一些样式
let isAddResetCss
if (this.mindMap.richText) {
const foreignObjectList = svg.find('foreignObject')
if (foreignObjectList.length > 0) {
foreignObjectList[0].add(SVG(`<style>${resetCss}</style>`))
isAddResetCss = true
svgIsChange = true
}
}
// 自定义处理svg的方法
if (typeof handleBeingExportSvg === 'function') {
svgIsChange = true
svg = handleBeingExportSvg(svg)
}
// svg节点内容有变需要重新获取html字符串
if (taskList.length > 0 || isAddResetCss) {
if (taskList.length > 0 || svgIsChange) {
svgHTML = svg.svg()
}
return {

View File

@@ -101,7 +101,7 @@ class Formula {
const m = [...insert.matchAll(/\$.+?\$/g)]
const arr = insert.split(/\$.+?\$/g)
for (let j = m.length - 1; j >= 0; j--) {
const exp = m[j]?.[0].slice(1, -1) ?? null // $...$ 之间的表达式
const exp = m[j] && m[j][0] ? m[j][0].slice(1, -1) || null : null // $...$ 之间的表达式
if (exp !== null && exp.trim().length > 0) {
const isLegal = this.checkFormulaIsLegal(exp)
if (isLegal) {

View File

@@ -19,6 +19,7 @@ class MiniMap {
x: 0,
y: 0
}
this.currentState = null
}
// 计算小地图的渲染数据
@@ -53,13 +54,16 @@ class MiniMap {
let miniMapBoxScale = actWidth / rect.width
let miniMapBoxLeft = (boxWidth - actWidth) / 2
let miniMapBoxTop = (boxHeight - actHeight) / 2
// 视口框大小及位置
let _rectX = rect.x - (rect.width * scaleX - rect.width) / 2
let _rectX2 = rect.x2 + (rect.width * scaleX - rect.width) / 2
let _rectY = rect.y - (rect.height * scaleY - rect.height) / 2
let _rectY2 = rect.y2 + (rect.height * scaleY - rect.height) / 2
// 当前思维导图图形实际的宽高,即在缩放后的宽高
let _rectWidth = rect.width * scaleX
let _rectHeight = rect.height * scaleY
// 视口框大小及位置
let _rectWidthOffsetHalf = (_rectWidth - rect.width) / 2
let _rectHeightOffsetHalf = (_rectHeight - rect.height) / 2
let _rectX = rect.x - _rectWidthOffsetHalf
let _rectX2 = rect.x2 + _rectWidthOffsetHalf
let _rectY = rect.y - _rectHeightOffsetHalf
let _rectY2 = rect.y2 + _rectHeightOffsetHalf
let viewBoxStyle = {
left: 0,
top: 0,
@@ -90,7 +94,14 @@ class MiniMap {
})
this.removeNodeContent(svg)
const svgStr = svg.svg()
this.currentState = {
viewBoxStyle: {
...viewBoxStyle
},
miniMapBoxScale,
miniMapBoxLeft,
miniMapBoxTop
}
return {
getImgUrl: async callback => {
const res = await this.mindMap.doExport.fixSvgStrAndToBlob(svgStr)
@@ -141,7 +152,7 @@ class MiniMap {
// 小地图鼠标移动事件
onMousemove(e, sensitivityNum = 5) {
if (!this.isMousedown) {
if (!this.isMousedown || this.isViewBoxMousedown) {
return
}
let ox = e.clientX - this.mousedownPos.x
@@ -154,6 +165,57 @@ class MiniMap {
// 小地图鼠标松开事件
onMouseup() {
this.isMousedown = false
this.isViewBoxMousedown = false
}
// 视口框鼠标按下事件
onViewBoxMousedown(e) {
this.isViewBoxMousedown = true
this.mousedownPos = {
x: e.clientX,
y: e.clientY
}
// 保存视图当前的偏移量
let transformData = this.mindMap.view.getTransformData()
this.startViewPos = {
x: transformData.state.x,
y: transformData.state.y
}
}
// 视口框鼠标移动事件
onViewBoxMousemove(e) {
if (!this.isViewBoxMousedown || !this.currentState || this.isMousedown)
return
let ox = e.clientX - this.mousedownPos.x
let oy = e.clientY - this.mousedownPos.y
const { viewBoxStyle, miniMapBoxScale, miniMapBoxLeft, miniMapBoxTop } =
this.currentState
const left = Math.max(
miniMapBoxLeft,
Number.parseFloat(viewBoxStyle.left) + ox
)
const right = Math.max(
miniMapBoxLeft,
Number.parseFloat(viewBoxStyle.right) - ox
)
const top = Math.max(
miniMapBoxTop,
Number.parseFloat(viewBoxStyle.top) + oy
)
const bottom = Math.max(
miniMapBoxTop,
Number.parseFloat(viewBoxStyle.bottom) - oy
)
this.mindMap.emit('mini_map_view_box_position_change', {
left: left + 'px',
right: right + 'px',
top: top + 'px',
bottom: bottom + 'px'
})
// 在视图最初偏移量上累加更新量
this.mindMap.view.translateXTo(-ox / miniMapBoxScale + this.startViewPos.x)
this.mindMap.view.translateYTo(-oy / miniMapBoxScale + this.startViewPos.y)
}
}

View File

@@ -0,0 +1,391 @@
import {
formatDataToArray,
walk,
getTopAncestorsFomNodeList,
getNodeListBoundingRect,
createUid
} from '../utils'
// 解析要添加外框的节点实例列表
const parseAddNodeList = list => {
// 找出顶层节点
list = getTopAncestorsFomNodeList(list)
const cache = {}
const uidToParent = {}
// 找出列表中节点在兄弟节点中的索引,并和父节点关联起来
list.forEach(node => {
const parent = node.parent
if (parent) {
const pUid = parent.uid
uidToParent[pUid] = parent
const index = node.getIndexInBrothers()
const data = {
node,
index
}
if (cache[pUid]) {
if (
!cache[pUid].find(item => {
return item.index === data.index
})
) {
cache[pUid].push(data)
}
} else {
cache[pUid] = [data]
}
}
})
const res = []
Object.keys(cache).forEach(uid => {
const indexList = cache[uid]
const parentNode = uidToParent[uid]
if (indexList.length > 1) {
// 多个节点
const rangeList = indexList
.map(item => {
return item.index
})
.sort((a, b) => {
return a - b
})
const minIndex = rangeList[0]
const maxIndex = rangeList[rangeList.length - 1]
let curStart = -1
let curEnd = -1
for (let i = minIndex; i <= maxIndex; i++) {
// 连续索引
if (rangeList.includes(i)) {
if (curStart === -1) {
curStart = i
}
curEnd = i
} else {
// 连续断开
if (curStart !== -1 && curEnd !== -1) {
res.push({
node: parentNode,
range: [curStart, curEnd]
})
}
curStart = -1
curEnd = -1
}
}
// 不要忘了最后一段索引
if (curStart !== -1 && curEnd !== -1) {
res.push({
node: parentNode,
range: [curStart, curEnd]
})
}
} else {
// 单个节点
res.push({
node: parentNode,
range: [indexList[0].index, indexList[0].index]
})
}
})
return res
}
// 解析获取节点的子节点生成的外框列表
const getNodeOuterFrameList = node => {
const children = node.children
if (!children || children.length <= 0) return
const res = []
const map = {}
children.forEach((item, index) => {
const outerFrameData = item.getData('outerFrame')
if (!outerFrameData) return
const groupId = outerFrameData.groupId
if (groupId) {
if (!map[groupId]) {
map[groupId] = []
}
map[groupId].push({
node: item,
index
})
} else {
res.push({
nodeList: [item],
range: [index, index]
})
}
})
Object.keys(map).forEach(id => {
const list = map[id]
res.push({
nodeList: list.map(item => {
return item.node
}),
range: [list[0].index, list[list.length - 1].index]
})
})
return res
}
// 默认外框样式
const defaultStyle = {
radius: 5,
strokeWidth: 2,
strokeColor: '#0984e3',
strokeDasharray: '5,5',
fill: 'rgba(9,132,227,0.05)'
}
// 外框插件
class OuterFrame {
constructor(opt = {}) {
this.mindMap = opt.mindMap
this.draw = null
this.createDrawContainer()
this.outerFrameElList = []
this.activeOuterFrame = null
this.paddingX = 10
this.paddingY = 10
this.bindEvent()
}
// 创建容器
createDrawContainer() {
this.draw = this.mindMap.draw.group()
this.draw.addClass('smm-outer-frame-container')
this.draw.back() // 最底层
this.draw.forward() // 连线层上面
}
// 绑定事件
bindEvent() {
this.renderOuterFrames = this.renderOuterFrames.bind(this)
this.mindMap.on('node_tree_render_end', this.renderOuterFrames)
this.mindMap.on('data_change', this.renderOuterFrames)
// 监听画布和节点点击事件,用于清除当前激活的连接线
this.clearActiveOuterFrame = this.clearActiveOuterFrame.bind(this)
this.mindMap.on('draw_click', this.clearActiveOuterFrame)
this.mindMap.on('node_click', this.clearActiveOuterFrame)
this.addOuterFrame = this.addOuterFrame.bind(this)
this.mindMap.command.add('ADD_OUTER_FRAME', this.addOuterFrame)
this.removeActiveOuterFrame = this.removeActiveOuterFrame.bind(this)
this.mindMap.keyCommand.addShortcut(
'Del|Backspace',
this.removeActiveOuterFrame
)
}
// 解绑事件
unBindEvent() {
this.mindMap.off('node_tree_render_end', this.renderOuterFrames)
this.mindMap.off('data_change', this.renderOuterFrames)
this.mindMap.off('draw_click', this.clearActiveOuterFrame)
this.mindMap.off('node_click', this.clearActiveOuterFrame)
this.mindMap.command.remove('ADD_OUTER_FRAME', this.addOuterFrame)
this.mindMap.keyCommand.removeShortcut(
'Del|Backspace',
this.removeActiveOuterFrame
)
}
// 给节点添加外框数据
/*
config: {
text: '',
radius: 5,
strokeWidth: 2,
strokeColor: '#0984e3',
strokeDasharray: '5,5',
fill: 'rgba(9,132,227,0.05)'
}
*/
addOuterFrame(appointNodes, config = {}) {
appointNodes = formatDataToArray(appointNodes)
const activeNodeList = this.mindMap.renderer.activeNodeList
if (activeNodeList.length <= 0 && appointNodes.length <= 0) {
return
}
let nodeList = appointNodes.length > 0 ? appointNodes : activeNodeList
nodeList = nodeList.filter(node => {
return !node.isRoot && !node.isGeneralization
})
const list = parseAddNodeList(nodeList)
list.forEach(({ node, range }) => {
const childNodeList = node.children.slice(range[0], range[1] + 1)
const groupId = createUid()
childNodeList.forEach(child => {
let outerFrame = child.getData('outerFrame')
// 检查该外框是否已存在
if (outerFrame) {
outerFrame = {
...outerFrame,
...config,
groupId
}
} else {
outerFrame = {
...config,
groupId
}
}
this.mindMap.execCommand('SET_NODE_DATA', child, {
outerFrame
})
})
})
}
// 获取当前激活的外框
getActiveOuterFrame() {
return this.activeOuterFrame
? {
...this.activeOuterFrame
}
: null
}
// 删除当前激活的外框
removeActiveOuterFrame() {
if (!this.activeOuterFrame) return
const { node, range } = this.activeOuterFrame
this.getRangeNodeList(node, range).forEach(child => {
this.mindMap.execCommand('SET_NODE_DATA', child, {
outerFrame: null
})
})
this.mindMap.emit('outer_frame_delete')
}
// 更新当前激活的外框
// 执行了该方法后请立即隐藏你的样式面板,因为会清除当前激活的外框
updateActiveOuterFrame(config = {}) {
if (!this.activeOuterFrame) return
const { node, range } = this.activeOuterFrame
this.getRangeNodeList(node, range).forEach(node => {
const outerFrame = node.getData('outerFrame')
this.mindMap.execCommand('SET_NODE_DATA', node, {
outerFrame: {
...outerFrame,
...config
}
})
})
}
// 获取某个节点指定范围的带外框的子节点列表
getRangeNodeList(node, range) {
return node.children.slice(range[0], range[1] + 1).filter(child => {
return child.getData('outerFrame')
})
}
// 渲染外框
renderOuterFrames() {
this.clearOuterFrameElList()
let tree = this.mindMap.renderer.root
if (!tree) return
const t = this.mindMap.draw.transform()
walk(
tree,
null,
cur => {
if (!cur) return
const outerFrameList = getNodeOuterFrameList(cur)
if (outerFrameList && outerFrameList.length > 0) {
outerFrameList.forEach(({ nodeList, range }) => {
if (range[0] === -1 || range[1] === -1) return
const { left, top, width, height } =
getNodeListBoundingRect(nodeList)
const el = this.createOuterFrameEl(
(left - this.paddingX - this.mindMap.elRect.left - t.translateX) /
t.scaleX,
(top - this.paddingY - this.mindMap.elRect.top - t.translateY) /
t.scaleY,
(width + this.paddingX * 2) / t.scaleX,
(height + this.paddingY * 2) / t.scaleY,
nodeList[0].getData('outerFrame') // 使用第一个节点的外框样式
)
el.on('click', e => {
e.stopPropagation()
this.setActiveOuterFrame(el, cur, range)
})
})
}
},
() => {},
true,
0
)
}
// 激活外框
setActiveOuterFrame(el, node, range) {
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
this.clearActiveOuterFrame()
this.activeOuterFrame = {
el,
node,
range
}
el.stroke({
dasharray: 'none'
})
this.mindMap.emit('outer_frame_active', el, node, range)
}
// 清除当前激活的外框
clearActiveOuterFrame() {
if (!this.activeOuterFrame) return
const { el } = this.activeOuterFrame
el.stroke({
dasharray: '5,5'
})
this.activeOuterFrame = null
}
// 创建外框元素
createOuterFrameEl(x, y, width, height, styleConfig = {}) {
styleConfig = { ...defaultStyle, ...styleConfig }
const el = this.draw
.rect()
.size(width, height)
.radius(styleConfig.radius)
.stroke({
width: styleConfig.strokeWidth,
color: styleConfig.strokeColor,
dasharray: styleConfig.strokeDasharray
})
.fill({
color: styleConfig.fill
})
.x(x)
.y(y)
this.outerFrameElList.push(el)
return el
}
// 清除外框元素
clearOuterFrameElList() {
this.outerFrameElList.forEach(item => {
item.remove()
})
this.outerFrameElList = []
this.activeOuterFrame = null
}
// 插件被移除前做的事情
beforePluginRemove() {
this.unBindEvent()
}
// 插件被卸载前做的事情
beforePluginDestroy() {
this.unBindEvent()
}
}
OuterFrame.instanceName = 'outerFrame'
export default OuterFrame

View File

@@ -344,7 +344,7 @@ class RichText {
// }
this.mindMap.render()
})
this.mindMap.emit('hide_text_edit', this.textEditNode, list)
this.mindMap.emit('hide_text_edit', this.textEditNode, list, this.node)
this.textEditNode.style.display = 'none'
this.showTextEdit = false
this.mindMap.emit('rich_text_selection_change', false)

View File

@@ -1,4 +1,5 @@
import { bfsWalk, throttle, checkTwoRectIsOverlap } from '../utils'
import AutoMove from '../utils/AutoMove'
// 节点选择插件
class Select {
@@ -13,6 +14,7 @@ class Select {
this.mouseMoveY = 0
this.isSelecting = false
this.cacheActiveList = []
this.autoMove = new AutoMove(mindMap)
this.bindEvent()
}
@@ -75,19 +77,21 @@ class Select {
) {
return
}
this.clearAutoMoveTimer()
this.onMove(
this.autoMove.clearAutoMoveTimer()
this.autoMove.onMove(
e.clientX,
e.clientY,
() => {
this.isSelecting = true
// 绘制矩形
this.rect.plot([
[this.mouseDownX, this.mouseDownY],
[this.mouseMoveX, this.mouseDownY],
[this.mouseMoveX, this.mouseMoveY],
[this.mouseDownX, this.mouseMoveY]
])
if (this.rect) {
this.rect.plot([
[this.mouseDownX, this.mouseDownY],
[this.mouseMoveX, this.mouseDownY],
[this.mouseMoveX, this.mouseMoveY],
[this.mouseDownX, this.mouseMoveY]
])
}
this.checkInNodes()
},
(dir, step) => {
@@ -120,7 +124,7 @@ class Select {
return
}
this.checkTriggerNodeActiveEvent()
clearTimeout(this.autoMoveTimer)
this.autoMove.clearAutoMoveTimer()
this.isMousedown = false
this.cacheActiveList = []
if (this.rect) this.rect.remove()
@@ -154,54 +158,6 @@ class Select {
}
}
// 鼠标移动事件
onMove(x, y, callback = () => {}, handle = () => {}) {
callback()
// 检测边缘移动
let step = this.mindMap.opt.selectTranslateStep
let limit = this.mindMap.opt.selectTranslateLimit
let count = 0
// 左边缘
if (x <= this.mindMap.elRect.left + limit) {
handle('left', step)
this.mindMap.view.translateX(step)
count++
}
// 右边缘
if (x >= this.mindMap.elRect.right - limit) {
handle('right', step)
this.mindMap.view.translateX(-step)
count++
}
// 上边缘
if (y <= this.mindMap.elRect.top + limit) {
handle('top', step)
this.mindMap.view.translateY(step)
count++
}
// 下边缘
if (y >= this.mindMap.elRect.bottom - limit) {
handle('bottom', step)
this.mindMap.view.translateY(-step)
count++
}
if (count > 0) {
this.startAutoMove(x, y, callback, handle)
}
}
// 开启自动移动
startAutoMove(x, y, callback, handle) {
this.autoMoveTimer = setTimeout(() => {
this.onMove(x, y, callback, handle)
}, 20)
}
// 清除自动移动定时器
clearAutoMoveTimer() {
clearTimeout(this.autoMoveTimer)
}
// 创建矩形
createRect(x, y) {
if (this.rect) this.rect.remove()

View File

@@ -1,3 +1,5 @@
import { getTwoPointDistance } from '../utils'
// 手势事件支持插件
class TouchEvent {
// 构造函数
@@ -7,6 +9,8 @@ class TouchEvent {
this.singleTouchstartEvent = null
this.clickNum = 0
this.touchStartScaleView = null
this.lastTouchStartPosition = null
this.lastTouchStartDistance = 0
this.bindEvent()
}
@@ -34,11 +38,22 @@ class TouchEvent {
// 手指按下事件
onTouchstart(e) {
e.preventDefault()
this.touchesNum = e.touches.length
this.touchStartScaleView = null
if (this.touchesNum === 1) {
let touch = e.touches[0]
if (this.lastTouchStartPosition) {
this.lastTouchStartDistance = getTwoPointDistance(
this.lastTouchStartPosition.x,
this.lastTouchStartPosition.y,
touch.clientX,
touch.clientY
)
}
this.lastTouchStartPosition = {
x: touch.clientX,
y: touch.clientY
}
this.singleTouchstartEvent = touch
this.dispatchMouseEvent('mousedown', touch.target, touch)
}
@@ -46,13 +61,18 @@ class TouchEvent {
// 手指移动事件
onTouchmove(e) {
e.preventDefault()
let len = e.touches.length
if (len === 1) {
let touch = e.touches[0]
this.dispatchMouseEvent('mousemove', touch.target, touch)
} else if (len === 2) {
if (this.mindMap.opt.disableTouchZoom) return
let { disableTouchZoom, minTouchZoomScale, maxTouchZoomScale } =
this.mindMap.opt
if (disableTouchZoom) return
minTouchZoomScale =
minTouchZoomScale === -1 ? -Infinity : minTouchZoomScale / 100
maxTouchZoomScale =
maxTouchZoomScale === -1 ? Infinity : maxTouchZoomScale / 100
let touch1 = e.touches[0]
let touch2 = e.touches[1]
let ox = touch1.clientX - touch2.clientX
@@ -87,8 +107,14 @@ class TouchEvent {
if (Math.abs(distance - viewBefore.distance) <= 10) {
scale = viewBefore.scale
}
scale =
scale < minTouchZoomScale
? minTouchZoomScale
: scale > maxTouchZoomScale
? maxTouchZoomScale
: scale
const ratio = 1 - scale / viewBefore.scale
view.scale = scale < 0.1 ? 0.1 : scale
view.scale = scale
view.x =
viewBefore.x +
(cx - viewBefore.x) * ratio +
@@ -107,16 +133,17 @@ class TouchEvent {
// 手指松开事件
onTouchend(e) {
e.preventDefault()
this.dispatchMouseEvent('mouseup', e.target)
if (this.touchesNum === 1) {
// 模拟双击事件
this.clickNum++
setTimeout(() => {
this.clickNum = 0
this.lastTouchStartPosition = null
this.lastTouchStartDistance = 0
}, 300)
let ev = this.singleTouchstartEvent
if (this.clickNum > 1) {
if (this.clickNum > 1 && this.lastTouchStartDistance <= 5) {
this.clickNum = 0
this.dispatchMouseEvent('dblclick', ev.target, ev)
} else {

View File

@@ -38,6 +38,7 @@ function createOneControlNode(pointKey) {
// 控制点的鼠标按下事件
function onControlPointMousedown(e, pointKey) {
e.stopPropagation()
e.preventDefault()
this.isControlPointMousedown = true
this.mousedownControlPointKey = pointKey
}

View File

@@ -20,7 +20,7 @@ export default {
lineStyle: 'straight', // 曲线curve【仅支持logicalStructure、mindMap、verticalTimeline三种结构】、直线straight、直连direct【仅支持logicalStructure、mindMap、organizationStructure、verticalTimeline四种结构】
// 曲线连接时,根节点和其他节点的连接线样式保持统一,默认根节点为 ( 型,其他节点为 { 型设为true后都为 { 型。仅支持logicalStructure、mindMap两种结构
rootLineKeepSameInCurve: true,
// 曲线连接时根节点和其他节点的连线起始位置保持统一默认根节点的连线起始位置在节点中心其他节点在节点右侧如果该配置设为true那么根节点的连线起始位置也会在节点右侧
// 曲线连接时,根节点和其他节点的连线起始位置保持统一,默认根节点的连线起始位置在节点中心,其他节点在节点右侧(或左侧)如果该配置设为true那么根节点的连线起始位置也会在节点右侧(或左侧)
rootLineStartPositionKeepSameInCurve: false,
// 直线连接(straight)时连线的圆角大小设置为0代表没有圆角仅支持logicalStructure、mindMap、verticalTimeline三种结构
lineRadius: 5,

View File

@@ -0,0 +1,57 @@
// 画布自动移动类
class AutoMove {
constructor(mindMap) {
this.mindMap = mindMap
this.autoMoveTimer = null
}
// 鼠标移动事件
onMove(x, y, callback = () => {}, handle = () => {}) {
callback()
// 检测边缘移动
let step = this.mindMap.opt.selectTranslateStep
let limit = this.mindMap.opt.selectTranslateLimit
let count = 0
// 左边缘
if (x <= this.mindMap.elRect.left + limit) {
handle('left', step)
this.mindMap.view.translateX(step)
count++
}
// 右边缘
if (x >= this.mindMap.elRect.right - limit) {
handle('right', step)
this.mindMap.view.translateX(-step)
count++
}
// 上边缘
if (y <= this.mindMap.elRect.top + limit) {
handle('top', step)
this.mindMap.view.translateY(step)
count++
}
// 下边缘
if (y >= this.mindMap.elRect.bottom - limit) {
handle('bottom', step)
this.mindMap.view.translateY(-step)
count++
}
if (count > 0) {
this.startAutoMove(x, y, callback, handle)
}
}
// 开启自动移动
startAutoMove(x, y, callback, handle) {
this.autoMoveTimer = setTimeout(() => {
this.onMove(x, y, callback, handle)
}, 20)
}
// 清除自动移动定时器
clearAutoMoveTimer() {
clearTimeout(this.autoMoveTimer)
}
}
export default AutoMove

View File

@@ -207,7 +207,7 @@ export const copyNodeTree = (
}
// 图片转成dataURL
export const imgToDataUrl = src => {
export const imgToDataUrl = (src, returnBlob = false) => {
return new Promise((resolve, reject) => {
const img = new Image()
// 跨域图片需要添加这个属性,否则画布被污染了无法导出图片
@@ -220,7 +220,13 @@ export const imgToDataUrl = src => {
let ctx = canvas.getContext('2d')
// 图片绘制到canvas里
ctx.drawImage(img, 0, 0, img.width, img.height)
resolve(canvas.toDataURL())
if (returnBlob) {
canvas.toBlob(blob => {
resolve(blob)
})
} else {
resolve(canvas.toDataURL())
}
} catch (e) {
reject(e)
}
@@ -1368,7 +1374,8 @@ export const getNodeTreeBoundingRect = (
y = 0,
paddingX = 0,
paddingY = 0,
excludeSelf = false
excludeSelf = false,
excludeGeneralization = false
) => {
let minX = Infinity
let maxX = -Infinity
@@ -1392,7 +1399,7 @@ export const getNodeTreeBoundingRect = (
maxY = y + height
}
}
if (root._generalizationList.length > 0) {
if (!excludeGeneralization && root._generalizationList.length > 0) {
root._generalizationList.forEach(item => {
walk(item.generalizationNode)
})
@@ -1418,6 +1425,49 @@ export const getNodeTreeBoundingRect = (
}
}
// 获取多个节点总的包围框
export const getNodeListBoundingRect = (
nodeList,
x = 0,
y = 0,
paddingX = 0,
paddingY = 0
) => {
let minX = Infinity
let maxX = -Infinity
let minY = Infinity
let maxY = -Infinity
nodeList.forEach(node => {
const { left, top, width, height } = getNodeTreeBoundingRect(
node,
x,
y,
paddingX,
paddingY,
false,
true
)
if (left < minX) {
minX = left
}
if (left + width > maxX) {
maxX = left + width
}
if (top < minY) {
minY = top
}
if (top + height > maxY) {
maxY = top + height
}
})
return {
left: minX,
top: minY,
width: maxX - minX,
height: maxY - minY
}
}
// 全屏事件检测
const getOnfullscreEnevt = () => {
if (document.documentElement.requestFullScreen) {

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 2479351 */
src: url('iconfont.woff2?t=1713438156457') format('woff2'),
url('iconfont.woff?t=1713438156457') format('woff'),
url('iconfont.ttf?t=1713438156457') format('truetype');
src: url('iconfont.woff2?t=1719815803051') format('woff2'),
url('iconfont.woff?t=1719815803051') format('woff'),
url('iconfont.ttf?t=1719815803051') format('truetype');
}
.iconfont {
@@ -13,6 +13,14 @@
-moz-osx-font-smoothing: grayscale;
}
.iconwaikuang:before {
content: "\e640";
}
.iconhighlight:before {
content: "\e6b8";
}
.iconyanshibofang:before {
content: "\e648";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -1,6 +1,7 @@
// 布局结构图片映射
export const layoutImgMap = {
logicalStructure: require('../assets/img/structures/logicalStructure.png'),
logicalStructureLeft: require('../assets/img/structures/logicalStructureLeft.jpg'),
mindMap: require('../assets/img/structures/mindMap.png'),
organizationStructure: require('../assets/img/structures/organizationStructure.png'),
catalogOrganization: require('../assets/img/structures/catalogOrganization.png'),
@@ -85,9 +86,15 @@ export const formulaList = [
]
export const supportLineStyleLayoutsMap = {
curve: ['logicalStructure', 'mindMap', 'verticalTimeline'],
curve: [
'logicalStructure',
'logicalStructureLeft',
'mindMap',
'verticalTimeline'
],
direct: [
'logicalStructure',
'logicalStructureLeft',
'mindMap',
'organizationStructure',
'verticalTimeline'
@@ -96,12 +103,14 @@ export const supportLineStyleLayoutsMap = {
export const supportLineRadiusLayouts = [
'logicalStructure',
'logicalStructureLeft',
'mindMap',
'verticalTimeline'
]
export const supportNodeUseLineStyleLayouts = [
'logicalStructure',
'logicalStructureLeft',
'mindMap',
'catalogOrganization',
'organizationStructure'
@@ -109,6 +118,7 @@ export const supportNodeUseLineStyleLayouts = [
export const supportRootLineKeepSameInCurveLayouts = [
'logicalStructure',
'logicalStructureLeft',
'mindMap'
]

View File

@@ -207,7 +207,7 @@ export const shortcutKeyList = [
{
icon: 'icontianjiazijiedian',
name: 'Inert child node',
value: 'Tab'
value: 'Tab | Insert'
},
{
icon: 'iconjiedian',

View File

@@ -273,7 +273,7 @@ export const shortcutKeyList = [
{
icon: 'icontianjiazijiedian',
name: '插入下级节点',
value: 'Tab'
value: 'Tab | Insert'
},
{
icon: 'iconjiedian',

View File

@@ -63,7 +63,7 @@ export default {
isUseHandDrawnLikeStyle: 'Is use hand drawn like style',
rootLineStartPos: 'Root line start pos',
center: 'Center',
right: 'Right',
edge: 'Edge',
rainbowLines: 'Rainbow lines',
notUseRainbowLines: 'Not use rainbow lines'
},
@@ -100,7 +100,15 @@ export default {
removeNote: 'Remove note',
removeCustomStyles: 'Remove custom styles',
removeAllNodeCustomStyles: 'Remove all node custom styles',
exportNodeToPng: 'Export node to png'
exportNodeToPng: 'Export node to png',
copyToClipboard: 'Copy to clipboard',
copyToSmm: 'SMM',
copyToJson: 'JSON',
copyToMarkdown: 'Markdown',
copyToTxt: 'Txt',
copyToPng: 'Png',
copySuccess: 'Copy success',
copyFail: 'Copy fail'
},
count: {
words: 'Words',
@@ -266,6 +274,7 @@ export default {
painter: 'Painter',
formula: 'Formula',
attachment: 'Attachment',
outerFrame: 'Outer frame',
more: 'More',
selectFileTip: 'Please select a file',
notSupportTip:
@@ -278,8 +287,10 @@ export default {
defaultFileName: 'Mind map',
creatingTip: 'Creating file',
directory: 'Directory',
newFileTip: 'Please export the currently edited file before creating a new one, otherwise the content will be lost',
openFileTip: 'Please export the currently edited file before opening it, otherwise the content will be lost'
newFileTip:
'Please export the currently edited file before creating a new one, otherwise the content will be lost',
openFileTip:
'Please export the currently edited file before opening it, otherwise the content will be lost'
},
edit: {
newFeatureNoticeTitle: 'New feature reminder',
@@ -333,7 +344,8 @@ export default {
loading: 'Loading, please wait...'
},
sourceCodeEdit: {
sourceCodeTip: 'It is not recommended to modify the style in rich text mode because it requires synchronous modification of data and HTML structure.',
sourceCodeTip:
'It is not recommended to modify the style in rich text mode because it requires synchronous modification of data and HTML structure.',
format: 'Format',
copy: 'Copy',
confirm: 'Complete',
@@ -345,5 +357,21 @@ export default {
attachment: {
deleteAttachment: 'Delete attachment',
tip: 'The attachment function is only available on the client side'
},
annotation: {
mark: 'Mark',
show: 'Show mark',
type: 'Type',
color: 'Color',
lineWidth: 'Line width',
padding: 'Padding',
animate: 'Animate'
},
nodeOuterFrame: {
outerFrameSetting: 'Setting',
deleteOuterFrame: 'Delete outer frame',
boxStyle: 'Box style',
boxColor: 'Box color',
fillColor: 'Fill color'
}
}

View File

@@ -63,7 +63,7 @@ export default {
isUseHandDrawnLikeStyle: '是否开启手绘风格',
rootLineStartPos: '根节点连线起始位置',
center: '中心',
right: '右侧',
edge: '边缘',
rainbowLines: '彩虹线条',
notUseRainbowLines: '不使用彩虹线条'
},
@@ -100,7 +100,15 @@ export default {
removeNote: '移除备注',
removeCustomStyles: '一键去除自定义样式',
removeAllNodeCustomStyles: '一键去除所有节点自定义样式',
exportNodeToPng: '导出该节点为图片'
exportNodeToPng: '导出该节点为图片',
copyToClipboard: '复制到剪贴板',
copyToSmm: 'SMM',
copyToJson: 'JSON',
copyToMarkdown: 'Markdown',
copyToTxt: 'Txt',
copyToPng: '图片',
copySuccess: '复制成功',
copyFail: '复制失败'
},
count: {
words: '字数',
@@ -263,6 +271,7 @@ export default {
painter: '格式刷',
formula: '公式',
attachment: '附件',
outerFrame: '外框',
more: '更多',
selectFileTip: '请选择文件',
notSupportTip: '你的浏览器不支持该功能或者当前页面非https协议',
@@ -327,7 +336,8 @@ export default {
loading: '正在加载,请稍后...'
},
sourceCodeEdit: {
sourceCodeTip: '富文本模式下不建议修改样式因为需要同步修改数据及html结构。',
sourceCodeTip:
'富文本模式下不建议修改样式因为需要同步修改数据及html结构。',
format: '格式化',
copy: '复制',
confirm: '完成',
@@ -339,5 +349,21 @@ export default {
attachment: {
deleteAttachment: '删除附件',
tip: '附件功能仅在客户端可用'
},
annotation: {
mark: '标记',
show: '显示标记',
type: '类型',
color: '颜色',
lineWidth: '线宽',
padding: '内边距',
animate: '开启动画'
},
nodeOuterFrame: {
outerFrameSetting: '外框设置',
deleteOuterFrame: '删除外框',
boxStyle: '边框样式',
boxColor: '边框颜色',
fillColor: '填充颜色'
}
}

View File

@@ -41,6 +41,8 @@ let APIList = [
'rainbowLines',
'handDrawnLikeStyle',
'demonstrate',
'notation',
'outerFrame',
'xmind',
'markdown',
'utils'

View File

@@ -1,5 +1,81 @@
# Changelog
## 0.10.2
> 2024.7.3
Fix:
> 1.Fix the issue of node text and custom content with the createNodePrefixContent option not being vertically centered;
>
> 2.Fix the issue of selecting node text when dragging the endpoints of associated lines;
New:
> 1.Add external frame plugins;
>
> 2.Add a leftward logical structure diagram;
>
> 3.The mini map supports dragging and dropping view boxes to adjust the canvas position;
>
> 4.Add an instantiation option to intercept nodes and start dragging them;
>
> 5.Prevent default behavior for mousedown, mousemove, drag, and node.mousedown events;
>
> 6.The beforeDragEnd option of the drag plugin adds a callback parameter to the list of nodes that are currently being dragged;
>
> 7.Add an instantiation option that prohibits reading and writing to the user's clipboard;
>
> 8.Independently separate the canvas automatic movement function of the Select plugin to solve the problem of the Drag plugin being unable to use the canvas automatic movement function without registering the Select plugin;
>
> 9.Add callback parameters to the edited node for the hide_text_edit event;
>
> 10.Activate the node when clicking on the hyperlink icon; Add instantiation options for custom hyperlink redirection;
Demo:
> 1.Color selection supports transparency selection;
>
> 2.Add external frame setting function;
>
> 3.Add copy to clipboard function in the right-click menu;
>
> 4.Add a leftward logical structure diagram;
>
> 5.Fix the issue where the event does not end after the mouse is moved out of the mini map and then released;
>
> 6.The mini map supports dragging and dropping view boxes to adjust the canvas position;
## 0.10.1
Fix:
> 1.Fix the issue where the TouchEvent plugin triggers node input when clicking twice at different positions;
>
> 2.Fix / shortcut the issue of being able to retrieve child nodes of the root node;
New:
> 1.Add instantiation options for handling SVG objects before export;
>
> 2.Add instantiation options for cloned nodes when modifying drag and drop nodes;
>
> 3.Add a content layout completion event for distributing individual nodes;
>
> 4.Add instantiation options for intercepting node drag and drop;
>
> 5.Add instantiation options to restrict the maximum and minimum values of TouchEvent plugin's double finger scaling;
>
> 6.Add node marker plugin;
Demo:
> 1.Add node marking function;
>
> 2.Fix the issue where the input box in the bottom right corner cannot be entered in demonstration mode;
>
> 3.Do not display directory, new, or open buttons when opening on the mobile end;
## 0.10.0
Major updates: Upgrade the interaction effect when dragging nodes;

View File

@@ -1,6 +1,58 @@
<template>
<div>
<h1>Changelog</h1>
<h2>0.10.2</h2>
<blockquote>
<p>2024.7.3</p>
</blockquote>
<p>Fix:</p>
<blockquote>
<p>1.Fix the issue of node text and custom content with the createNodePrefixContent option not being vertically centered;</p>
<p>2.Fix the issue of selecting node text when dragging the endpoints of associated lines;</p>
</blockquote>
<p>New:</p>
<blockquote>
<p>1.Add external frame plugins;</p>
<p>2.Add a leftward logical structure diagram;</p>
<p>3.The mini map supports dragging and dropping view boxes to adjust the canvas position;</p>
<p>4.Add an instantiation option to intercept nodes and start dragging them;</p>
<p>5.Prevent default behavior for mousedown, mousemove, drag, and node.mousedown events;</p>
<p>6.The beforeDragEnd option of the drag plugin adds a callback parameter to the list of nodes that are currently being dragged;</p>
<p>7.Add an instantiation option that prohibits reading and writing to the user's clipboard;</p>
<p>8.Independently separate the canvas automatic movement function of the Select plugin to solve the problem of the Drag plugin being unable to use the canvas automatic movement function without registering the Select plugin;</p>
<p>9.Add callback parameters to the edited node for the hide_text_edit event;</p>
<p>10.Activate the node when clicking on the hyperlink icon; Add instantiation options for custom hyperlink redirection;</p>
</blockquote>
<p>Demo:</p>
<blockquote>
<p>1.Color selection supports transparency selection;</p>
<p>2.Add external frame setting function;</p>
<p>3.Add copy to clipboard function in the right-click menu;</p>
<p>4.Add a leftward logical structure diagram;</p>
<p>5.Fix the issue where the event does not end after the mouse is moved out of the mini map and then released;</p>
<p>6.The mini map supports dragging and dropping view boxes to adjust the canvas position;</p>
</blockquote>
<h2>0.10.1</h2>
<p>Fix:</p>
<blockquote>
<p>1.Fix the issue where the TouchEvent plugin triggers node input when clicking twice at different positions;</p>
<p>2.Fix / shortcut the issue of being able to retrieve child nodes of the root node;</p>
</blockquote>
<p>New:</p>
<blockquote>
<p>1.Add instantiation options for handling SVG objects before export;</p>
<p>2.Add instantiation options for cloned nodes when modifying drag and drop nodes;</p>
<p>3.Add a content layout completion event for distributing individual nodes;</p>
<p>4.Add instantiation options for intercepting node drag and drop;</p>
<p>5.Add instantiation options to restrict the maximum and minimum values of TouchEvent plugin's double finger scaling;</p>
<p>6.Add node marker plugin;</p>
</blockquote>
<p>Demo:</p>
<blockquote>
<p>1.Add node marking function;</p>
<p>2.Fix the issue where the input box in the bottom right corner cannot be entered in demonstration mode;</p>
<p>3.Do not display directory, new, or open buttons when opening on the mobile end;</p>
</blockquote>
<h2>0.10.0</h2>
<p>Major updates: Upgrade the interaction effect when dragging nodes;</p>
<p>Fix:</p>

View File

@@ -5,8 +5,20 @@ includes many built-in commands and can also be added manually. A command refers
to an operation that needs to add a copy to the history stack data. The
`mindMap.command` instance can be obtained through this."
## Props
### history
The current list of all historical data. Do not manually modify the array.
### activeHistoryIndex
The current historical data index. Do not manually modify this property.
## Methods
Please use the command 'Back' or 'FORWARD' to move forward or backward.
### pause()
> v0.9.11+
@@ -38,7 +50,7 @@ removed
### getCopyData()
Get a copy of the rendering tree data
Get a copy of the rendering tree data. That is, the data of the current canvas.
### clearHistory()

View File

@@ -5,7 +5,13 @@
includes many built-in commands and can also be added manually. A command refers
to an operation that needs to add a copy to the history stack data. The
<code>mindMap.command</code> instance can be obtained through this.&quot;</p>
<h2>Props</h2>
<h3>history</h3>
<p>The current list of all historical data. Do not manually modify the array.</p>
<h3>activeHistoryIndex</h3>
<p>The current historical data index. Do not manually modify this property.</p>
<h2>Methods</h2>
<p>Please use the command 'Back' or 'FORWARD' to move forward or backward.</p>
<h3>pause()</h3>
<blockquote>
<p>v0.9.11+</p>
@@ -26,7 +32,7 @@ to an operation that needs to add a copy to the history stack data. The
<p><code>fn</code>: Method to be removed, if not provided all methods for the command will be
removed</p>
<h3>getCopyData()</h3>
<p>Get a copy of the rendering tree data</p>
<p>Get a copy of the rendering tree data. That is, the data of the current canvas.</p>
<h3>clearHistory()</h3>
<p>Clear the history stack data</p>

View File

@@ -28,7 +28,7 @@ const mindMap = new MindMap({
| -------------------------------- | ------- | ---------------- | ------------------------------------------- | -------- |
| el | Element | | Container element, must be a DOM elementWhen the position of container elements on the page has changed but the size has not changed, the 'getElRectInfo()' method must be called to update the relevant information inside the library; When the size also changes, the 'resize()' method must be called, otherwise it will cause some functional exceptions | Yes |
| data | Object 、null | | Mind map data, Please refer to the introduction of 【Data structure】 below. V0.9.9+supports passing empty objects or null, and the canvas will display blank space | |
| layout | String | logicalStructure | Layout type, options: logicalStructure (logical structure diagram), mindMap (mind map), catalogOrganization (catalog organization diagram), organizationStructure (organization structure diagram)、timelinev0.5.4+, timeline、timeline2v0.5.4+, up down alternating timeline、fishbonev0.5.4+, fishbone diagram | |
| layout | String | logicalStructure | Layout type, options: logicalStructure (logical structure diagram), logicalStructureLeft(v0.10.2+, Leftward logical structure diagram), mindMap (mind map), catalogOrganization (catalog organization diagram), organizationStructure (organization structure diagram)、timelinev0.5.4+, timeline、timeline2v0.5.4+, up down alternating timeline、fishbonev0.5.4+, fishbone diagram | |
| fishboneDegv0.5.4+ | Number | 45 | Set the diagonal angle of the fishbone structure diagram | |
| theme | String | default | Theme, options: default, classic, minions, pinkGrape, mint, gold, vitalityOrange, greenLeaf, dark2, skyGreen, classic2, classic3, classic4(v0.2.0+), classicGreen, classicBlue, blueSky, brainImpairedPink, dark, earthYellow, freshGreen, freshRed, romanticPurple, simpleBlack(v0.5.4+), courseGreen(v0.5.4+), coffee(v0.5.4+), redSpirit(v0.5.4+), blackHumour(v0.5.4+), lateNightOffice(v0.5.4+), blackGold(v0.5.4+)、、avocado(v.5.10-fix.2+)、autumn(v.5.10-fix.2+)、orangeJuice(v.5.10-fix.2+) | |
| themeConfig | Object | {} | Theme configuration, will be merged with the selected theme, available fields refer to: [default.js](https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/themes/default.js) | |
@@ -93,9 +93,11 @@ const mindMap = new MindMap({
| handleNodePasteImgv0.9.2+ | null or Function | null | The processing method for pasting images from the clipboard on a node is to convert them into data:URL data and insert them into the node by default. You can use this method to upload image data to the server and save the URL of the image. An asynchronous method can be passed to receive image data of Blob type, and the specified structure needs to be returned: { url, size: {width, height} } | |
| isLimitMindMapInCanvasv0.9.2+ | Boolean | false | Whether to limit the mind map within the canvas. For example, when dragging to the right, the leftmost part of the mind map graphic will not be able to continue dragging to the right when it reaches the center of the canvas, and the same applies to other things | |
| beforeShortcutRunv0.9.9+ | Function、null | null | The lifecycle function before the shortcut operation is about to be executed, returning true can prevent the operation from executing. The function takes two parameters: keyShortcut key、activeNodeListList of currently activated nodes | |
| resetScaleOnMoveNodeToCenterv0.9.12+ | Boolean | false | Whether to reset the scaling level to 100% when moving nodes to the canvas center, returning to the root node, and other operationsThe underlying impact is on the moveNodeToCenter method of the render class | |
| resetScaleOnMoveNodeToCenterv0.9.12+ | Boolean | false | Whether to reset the scaling level to 100% when moving nodes to the canvas center, returning to the root node, and other operationsThis option actually affects the render. moveNodeToCenter method, and the moveNodeToCenter method itself also has a second parameter, resetScale, to set whether to reset. If the resetScale parameter is not passed, then use resetScaleOnMoveNodeToCenter configuration; otherwise, use resetScale configuration | |
| createNodePrefixContentv0.9.12+ | Function、null | null | Add additional node pre content.Pre content refers to the pre content in the area of the same line as the text, excluding the node image section.You can pass a function that takes the parameters of a node instance, Can return objects in {el, width, height} format, el is a DOM node object, width and height represent the width, height, and numerical type of the content. If custom content is not required, null can also be returned | |
| createNodePostfixContentv0.9.12+ | Function、null | null | Add additional node post content.Post content refers to the post content in the area of the same line as the text, excluding the node image section. The usage is the same as createNodePrefixContent | |
| disabledClipboardv0.10.2+ | Boolean | false | Is prohibit pasting data from the user's clipboard and writing copied node data to the user's clipboard. At this time, only node data from the canvas can be copied and pasted | |
| customHyperlinkJumpv0.10.2+ | null、Function | false | Customize the jump of hyperlinks. If not passed, the hyperlink will be opened as a new window by default, and a function can be passed, The function takes two parameters: linkThe URL of the hyperlink、nodeNode instance to which it belongs, As long as a function is passed, it will block the default jump | |
### 1.1Data structure
@@ -159,6 +161,7 @@ If you want to add custom fields, you can add them to the same level as 'data' a
| minExportImgCanvasScalev0.7.0+ | Number | 2 | The scaling factor of canvas when exporting images and PDFs, which is set to the maximum value of window.devicePixelRatio to improve image clarity | |
| addContentToHeaderv0.9.9+ | Function、null | null | Add custom content to the header when exporting PNG, SVG, and PDF. Can pass a function that can return null to indicate no content is added, or it can return an object, For a detailed introduction, please refer to section 【How to add custom content when exporting】 below | |
| addContentToFooterv0.9.9+ | Function、null | null | The basic definition is the same as addContentToHeader, adding custom content at the end | |
| handleBeingExportSvgv0.10.1+ | Function、null | null | When exporting PNG, SVG, and PDF, the SVG data on the canvas will be obtained for cloning, and then exported through the cloned elements. If you want to do some processing on the cloned elements, such as adding, replacing, or modifying some of them, you can pass a processing function through this parameter to receive the SVG element object. After processing, you need to return the original SVG element object.It should be noted that the node object refers to the element object of the @ svgdotjs/svg. js library, so you need to read the documentation of the library to operate this object | |
#### 2.1How to add custom content when exporting
@@ -213,6 +216,9 @@ new MindMap({
| dragPlaceholderRectFillv0.7.2+ | String | rgb(94, 200, 248) | The filling color of the schematic rectangle for the new position when dragging nodes. | |
| dragPlaceholderLineConfigv0.10.0+ | Object | { color: 'rgb(94, 200, 248)', width: 2 } | Style configuration of schematic lines for new positions when dragging nodes | |
| dragOpacityConfigv0.7.2+ | Object | { cloneNodeOpacity: 0.5, beingDragNodeOpacity: 0.3 } | The transparency configuration during node dragging, passing an object, and the field meanings are: the transparency of the cloned node or rectangle that follows the mouse movement, and the transparency of the dragged node | |
| beforeDragEndv0.10.1+ | null、Function | null | This function is called just before the drag is completed. The function receives an object as a parameter: {overlapNodeUid,prevNodeUid,nextNodeUid,beingDragNodeList}, represents drag and drop information. If you want to prevent this drag and drop, you can return true. At this time, the node.drag event will not be triggered again. Functions can be asynchronous and return Promise instances. 'beingDragNodeList' is a newly added callback parameter for v0.10.2+, which is the list of nodes that are currently being dragged | |
| handleDragCloneNodev0.10.1+ | null、Function | null | When dragging a single node, the dragged node will be cloned. If you want to modify the cloned node, you can provide a processing function through this option, which receives the cloned node object.It should be noted that the node object refers to the element object of the @svgdotjs/svg.js library, so you need to read the documentation of the library to operate this object | |
| beforeDragStartv0.10.2+ | null、Function(nodeList) => {} | null | This function is called just before the node is dragged. The function receives the list of node instances to be dragged as parameters. If you want to prevent this drag, you can return true. It can be an asynchronous function that returns a Promise instance | |
### 5.Watermark plugin
@@ -256,6 +262,8 @@ new MindMap({
| Field Name | Type | Default Value | Description | Required |
| -------------------------------- | ------- | ---------------- | ------------------------------------------- | -------- |
| disableTouchZoomv0.8.1+ | Boolean | false | Prohibit double finger scaling, you can still use the API for scaling, which takes effect on the TouchEvent plugin | |
| minTouchZoomScalev0.10.1+ | Number | 20 | Allow maximum and minimum scaling values, percentage, pass -1 to indicate no restrictions | |
| maxTouchZoomScalev0.10.1+ | Number | -1 | Same as minTouchZoomScale | |
### 9.Scrollbar plugin
@@ -546,7 +554,7 @@ Listen to an event. Event list:
| node_active | Node activation event | this (node instance), activeNodeList (current list of active nodes) |
| expand_btn_click | Node expand or collapse event | this (node instance) |
| before_show_text_edit | Event before node text edit box opens | |
| hide_text_edit | Node text edit box close event | textEditNode (text edit box DOM node), activeNodeList (current list of active nodes) |
| hide_text_edit | Node text edit box close event【The end of text editing for the associated line will also trigger this event, and there are no callback parameters at this time, so defensive programming is necessary】 | textEditNode (text edit box DOM node), activeNodeList (current list of active nodes) 、nodev0.10.2+, Node instance for current text editing |
| scale | Canvas zoom event | scale (zoom ratio) |
| translatev0.9.10+ | Canvas movement event | xtranslate x、ytranslate y |
| node_img_dblclickv0.2.15+ | Node image double-click event | this (node instance), e (event object) |
@@ -579,6 +587,9 @@ Listen to an event. Event list:
| exit_demonstratev0.9.11+ | Triggered when exiting demonstration mode | |
| demonstrate_jumpv0.9.11+ | Trigger when switching steps in demonstration mode | currentStepIndexThe index of the steps currently played, counting from 0、stepLengthTotal number of playback steps |
| node_tag_clickv0.9.12+ | Click events on node labels | this(Current node instance)、itemContent of clicked tags |
| node_layout_endv0.10.1+ | Event where the content layout of a single node is completed | this(Current node instance) |
| node_attachmentClickv0.9.10+ | Click event for node attachment icon | this(Current node instance)、eEvent Object、nodeIcon node |
| node_attachmentContextmenuv0.9.10+ | Right click event on node attachment icon | this(Current node instance)、eEvent Object、nodeIcon node |
### emit(event, ...args)

View File

@@ -47,7 +47,7 @@
<td>layout</td>
<td>String</td>
<td>logicalStructure</td>
<td>Layout type, options: logicalStructure (logical structure diagram), mindMap (mind map), catalogOrganization (catalog organization diagram), organizationStructure (organization structure diagram)timelinev0.5.4+, timelinetimeline2v0.5.4+, up down alternating timelinefishbonev0.5.4+, fishbone diagram</td>
<td>Layout type, options: logicalStructure (logical structure diagram), logicalStructureLeft(v0.10.2+, Leftward logical structure diagram), mindMap (mind map), catalogOrganization (catalog organization diagram), organizationStructure (organization structure diagram)timelinev0.5.4+, timelinetimeline2v0.5.4+, up down alternating timelinefishbonev0.5.4+, fishbone diagram</td>
<td></td>
</tr>
<tr>
@@ -502,7 +502,7 @@
<td>resetScaleOnMoveNodeToCenterv0.9.12+</td>
<td>Boolean</td>
<td>false</td>
<td>Whether to reset the scaling level to 100% when moving nodes to the canvas center, returning to the root node, and other operationsThe underlying impact is on the moveNodeToCenter method of the render class</td>
<td>Whether to reset the scaling level to 100% when moving nodes to the canvas center, returning to the root node, and other operationsThis option actually affects the render. moveNodeToCenter method, and the moveNodeToCenter method itself also has a second parameter, resetScale, to set whether to reset. If the resetScale parameter is not passed, then use resetScaleOnMoveNodeToCenter configuration; otherwise, use resetScale configuration</td>
<td></td>
</tr>
<tr>
@@ -519,6 +519,20 @@
<td>Add additional node post content.Post content refers to the post content in the area of the same line as the text, excluding the node image section. The usage is the same as createNodePrefixContent</td>
<td></td>
</tr>
<tr>
<td>disabledClipboardv0.10.2+</td>
<td>Boolean</td>
<td>false</td>
<td>Is prohibit pasting data from the user's clipboard and writing copied node data to the user's clipboard. At this time, only node data from the canvas can be copied and pasted</td>
<td></td>
</tr>
<tr>
<td>customHyperlinkJumpv0.10.2+</td>
<td>null、Function</td>
<td>false</td>
<td>Customize the jump of hyperlinks. If not passed, the hyperlink will be opened as a new window by default, and a function can be passed, The function takes two parameters: linkThe URL of the hyperlink、nodeNode instance to which it belongs, As long as a function is passed, it will block the default jump</td>
<td></td>
</tr>
</tbody>
</table>
<h3>1.1Data structure</h3>
@@ -651,6 +665,13 @@
<td>The basic definition is the same as addContentToHeader, adding custom content at the end</td>
<td></td>
</tr>
<tr>
<td>handleBeingExportSvgv0.10.1+</td>
<td>Function、null</td>
<td>null</td>
<td>When exporting PNG, SVG, and PDF, the SVG data on the canvas will be obtained for cloning, and then exported through the cloned elements. If you want to do some processing on the cloned elements, such as adding, replacing, or modifying some of them, you can pass a processing function through this parameter to receive the SVG element object. After processing, you need to return the original SVG element object.It should be noted that the node object refers to the element object of the @ svgdotjs/svg. js library, so you need to read the documentation of the library to operate this object</td>
<td></td>
</tr>
</tbody>
</table>
<h4>2.1How to add custom content when exporting</h4>
@@ -770,6 +791,27 @@
<td>The transparency configuration during node dragging, passing an object, and the field meanings are: the transparency of the cloned node or rectangle that follows the mouse movement, and the transparency of the dragged node</td>
<td></td>
</tr>
<tr>
<td>beforeDragEndv0.10.1+</td>
<td>null、Function</td>
<td>null</td>
<td>This function is called just before the drag is completed. The function receives an object as a parameter: {overlapNodeUid,prevNodeUid,nextNodeUid,beingDragNodeList}, represents drag and drop information. If you want to prevent this drag and drop, you can return true. At this time, the node.drag event will not be triggered again. Functions can be asynchronous and return Promise instances. 'beingDragNodeList' is a newly added callback parameter for v0.10.2+, which is the list of nodes that are currently being dragged</td>
<td></td>
</tr>
<tr>
<td>handleDragCloneNodev0.10.1+</td>
<td>null、Function</td>
<td>null</td>
<td>When dragging a single node, the dragged node will be cloned. If you want to modify the cloned node, you can provide a processing function through this option, which receives the cloned node object.It should be noted that the node object refers to the element object of the @svgdotjs/svg.js library, so you need to read the documentation of the library to operate this object</td>
<td></td>
</tr>
<tr>
<td>beforeDragStartv0.10.2+</td>
<td>null、Function(nodeList) =&gt; {}</td>
<td>null</td>
<td>This function is called just before the node is dragged. The function receives the list of node instances to be dragged as parameters. If you want to prevent this drag, you can return true. It can be an asynchronous function that returns a Promise instance</td>
<td></td>
</tr>
</tbody>
</table>
<h3>5.Watermark plugin</h3>
@@ -958,6 +1000,20 @@
<td>Prohibit double finger scaling, you can still use the API for scaling, which takes effect on the TouchEvent plugin</td>
<td></td>
</tr>
<tr>
<td>minTouchZoomScalev0.10.1+</td>
<td>Number</td>
<td>20</td>
<td>Allow maximum and minimum scaling values, percentage, pass -1 to indicate no restrictions</td>
<td></td>
</tr>
<tr>
<td>maxTouchZoomScalev0.10.1+</td>
<td>Number</td>
<td>-1</td>
<td>Same as minTouchZoomScale</td>
<td></td>
</tr>
</tbody>
</table>
<h3>9.Scrollbar plugin</h3>
@@ -1403,8 +1459,8 @@ poor performance and should be used sparingly.</p>
</tr>
<tr>
<td>hide_text_edit</td>
<td>Node text edit box close event</td>
<td>textEditNode (text edit box DOM node), activeNodeList (current list of active nodes)</td>
<td>Node text edit box close event【The end of text editing for the associated line will also trigger this event, and there are no callback parameters at this time, so defensive programming is necessary】</td>
<td>textEditNode (text edit box DOM node), activeNodeList (current list of active nodes) 、nodev0.10.2+, Node instance for current text editing</td>
</tr>
<tr>
<td>scale</td>
@@ -1566,6 +1622,21 @@ poor performance and should be used sparingly.</p>
<td>Click events on node labels</td>
<td>this(Current node instance)、itemContent of clicked tags</td>
</tr>
<tr>
<td>node_layout_endv0.10.1+</td>
<td>Event where the content layout of a single node is completed</td>
<td>this(Current node instance)</td>
</tr>
<tr>
<td>node_attachmentClickv0.9.10+</td>
<td>Click event for node attachment icon</td>
<td>this(Current node instance)、eEvent Object、nodeIcon node</td>
</tr>
<tr>
<td>node_attachmentContextmenuv0.9.10+</td>
<td>Right click event on node attachment icon</td>
<td>this(Current node instance)、eEvent Object、nodeIcon node</td>
</tr>
</tbody>
</table>
<h3>emit(event, ...args)</h3>

View File

@@ -9,7 +9,7 @@
## Features
- [x] Pluggable architecture, in addition to core functions, other functions are provided as plugins, which can be used as needed to reduce packaging volume
- [x] Support logical structure chart, mind map, Organizational chart, directory organization chart, timeline (horizontal and vertical), fishbone chart and other structures
- [x] Support logical structure chart(Left and Right Logical Structure Diagram), mind map, Organizational chart, directory organization chart, timeline (horizontal and vertical), fishbone chart and other structures
- [x] Built-in multiple themes, allowing for highly customizable styles, and supporting registration of new themes
- [x] Node content supports text (regular text, rich text), images, icons, hyperlinks, notes, labels, summaries, and math formulas
- [x] Nodes support drag and drop (drag and move, freely adjust), multiple node shapes, Support for expanding node content, and fully customize node content using DDM
@@ -23,7 +23,7 @@
The official provides the following plugins, which can be introduced as needed (a certain function may not be effective because you did not introduce the corresponding plugin). Please refer to the documentation for specific usage methods:
> RichTextNode Rich Text Plugin、SelectMouse Multiple Selection Node Plugin、DragNode drag plugin、AssociativeLineAssociate Line Plugin、ExportExport plugin、KeyboardNavigationKeyboard navigation plugin、MiniMapMini Map Plugin、WatermarkWatermark plugin、TouchEventMobile touch event support plugin、NodeImgAdjustDrag and adjust node image size plugin、SearchSearch plugin、PainterNode Format Brush Plugin、ScrollbarScroll bar plugin、FormulaMathematical Formula Plugin、CooperateCollaborative editing plugin、RainbowLinesRainbow Line Plugin、DemonstrateDemonstration mode plugin、HandDrawnLikeStyleHand drawn style plugin[收费]
> RichTextNode Rich Text Plugin、SelectMouse Multiple Selection Node Plugin、DragNode drag plugin、AssociativeLineAssociate Line Plugin、ExportExport plugin、KeyboardNavigationKeyboard navigation plugin、MiniMapMini Map Plugin、WatermarkWatermark plugin、TouchEventMobile touch event support plugin、NodeImgAdjustDrag and adjust node image size plugin、SearchSearch plugin、PainterNode Format Brush Plugin、ScrollbarScroll bar plugin、FormulaMathematical Formula Plugin、CooperateCollaborative editing plugin、RainbowLinesRainbow Line Plugin、DemonstrateDemonstration mode pluginOuterFrameOuter frame pluginHandDrawnLikeStyleHand drawn style plugin[charge]、NotationNode marker plugin[charge]
Features that will not be implemented in this project:
@@ -383,7 +383,7 @@ Open source is not easy. If this project is helpful to you, you can invite the a
<p>庆国</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/孟照星.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<img src="../../../../assets/avatar/Alex.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>Alex</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
@@ -410,4 +410,34 @@ Open source is not easy. If this project is helpful to you, you can invite the a
<img src="../../../../assets/avatar/峰.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>峰</p>
</div>
</div>
</div>
<div style="display: flex;">
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/default.png" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>协成</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/木木.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>木木</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/好名字.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>好名字</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/Kyle.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>Kyle</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/lsytyrt.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>lsytyrt</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/秀树因馨雨.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>秀树因馨雨</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/buddy.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>buddy</p>
</div>
</div>

View File

@@ -9,7 +9,7 @@
<h2>Features</h2>
<ul>
<li><input type="checkbox" id="checkbox17" checked="true" /><label for="checkbox17">Pluggable architecture, in addition to core functions, other functions are provided as plugins, which can be used as needed to reduce packaging volume</label></li>
<li><input type="checkbox" id="checkbox18" checked="true" /><label for="checkbox18">Support logical structure chart, mind map, Organizational chart, directory organization chart, timeline (horizontal and vertical), fishbone chart and other structures</label></li>
<li><input type="checkbox" id="checkbox18" checked="true" /><label for="checkbox18">Support logical structure chart(Left and Right Logical Structure Diagram), mind map, Organizational chart, directory organization chart, timeline (horizontal and vertical), fishbone chart and other structures</label></li>
<li><input type="checkbox" id="checkbox19" checked="true" /><label for="checkbox19">Built-in multiple themes, allowing for highly customizable styles, and supporting registration of new themes</label></li>
<li><input type="checkbox" id="checkbox20" checked="true" /><label for="checkbox20">Node content supports text (regular text, rich text), images, icons, hyperlinks, notes, labels, summaries, and math formulas</label></li>
<li><input type="checkbox" id="checkbox21" checked="true" /><label for="checkbox21">Nodes support drag and drop (drag and move, freely adjust), multiple node shapes, Support for expanding node content, and fully customize node content using DDM</label></li>
@@ -23,7 +23,7 @@
</ul>
<p>The official provides the following plugins, which can be introduced as needed (a certain function may not be effective because you did not introduce the corresponding plugin). Please refer to the documentation for specific usage methods:</p>
<blockquote>
<p>RichTextNode Rich Text PluginSelectMouse Multiple Selection Node PluginDragNode drag pluginAssociativeLineAssociate Line PluginExportExport pluginKeyboardNavigationKeyboard navigation pluginMiniMapMini Map PluginWatermarkWatermark pluginTouchEventMobile touch event support pluginNodeImgAdjustDrag and adjust node image size pluginSearchSearch pluginPainterNode Format Brush PluginScrollbarScroll bar pluginFormulaMathematical Formula PluginCooperateCollaborative editing pluginRainbowLinesRainbow Line PluginDemonstrateDemonstration mode pluginHandDrawnLikeStyleHand drawn style plugin[收费]</p>
<p>RichTextNode Rich Text PluginSelectMouse Multiple Selection Node PluginDragNode drag pluginAssociativeLineAssociate Line PluginExportExport pluginKeyboardNavigationKeyboard navigation pluginMiniMapMini Map PluginWatermarkWatermark pluginTouchEventMobile touch event support pluginNodeImgAdjustDrag and adjust node image size pluginSearchSearch pluginPainterNode Format Brush PluginScrollbarScroll bar pluginFormulaMathematical Formula PluginCooperateCollaborative editing pluginRainbowLinesRainbow Line PluginDemonstrateDemonstration mode pluginOuterFrameOuter frame pluginHandDrawnLikeStyleHand drawn style plugin[charge]NotationNode marker plugin[charge]</p>
</blockquote>
<p>Features that will not be implemented in this project:</p>
<blockquote>
@@ -337,7 +337,7 @@ full screen, support mini map</li>
<p>庆国</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/孟照星.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<img src="../../../../assets/avatar/Alex.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>Alex</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
@@ -365,6 +365,37 @@ full screen, support mini map</li>
<p></p>
</div>
</div>
<div style="display: flex;">
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/default.png" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>协成</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/木木.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>木木</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/好名字.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>好名字</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/Kyle.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>Kyle</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/lsytyrt.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>lsytyrt</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/秀树因馨雨.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>秀树因馨雨</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/buddy.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>buddy</p>
</div>
</div>
</div>
</template>

View File

@@ -81,13 +81,16 @@ At this point, when the mind map on the canvas changes, the small map will also
be updated in real time, and the view box element will reflect the position of
the viewport on the mind map graph in real time
6.Listen for the `mousedown`, `mousemove`, and `mouseup` events of the
`container` element, and call the three methods that will be introduced below to
achieve the effect of the mind map on the canvas being dragged with the mouse
6.Listen for the `mousedown`, `mousemove`events of the
`container` element, And listen for the 'mouseup' event of the 'window' (if 'mouseup' is bound to the 'container' element, the entire dragging behavior of the 'container' element cannot be stopped when the mouse is moved out), and call the three methods that will be introduced below to achieve the effect of the mind map on the canvas being dragged with the mouse
7.In v0.10.2+version, it supports dragging and dropping viewport boxes within the mini map to achieve synchronized dragging of the canvas, Implementing this feature can listen to the 'mousedown' of the 'viewBoxContainer' elementNeed to prevent bubbles, otherwise it will trigger the 'mousedown' event of the 'container' element`mousemove` event, Call the 'onViewBoxMousedown' and 'onViewBoxMousemove' methods of the mini map plugin instance separately, At the same time, it is necessary to listen for the 'mini_map_view_box_position_change' event to update the viewBoxContainer element in real-time
For detailed tutorials, please refer to[How to render a mini map](https://wanglin2.github.io/mind-map/#/doc/zh/course14)。
### onMousedown(e)
Small map mouse down event executes this function
Small map mouse down event executes this function.
`e`: event object
@@ -99,8 +102,20 @@ This function is executed on the small map mouse move event.
`sensitivityNum`: drag sensitivity, the higher the sensitivity, the greater the
actual canvas dragging distance on the small map when dragging the same distance
on the small map
on the small map.
### onMouseup()
This function is executed on the small map mouse release event.
This function is executed on the small map mouse release event.
### onViewBoxMousedown(e)
> v0.10.2+
Call this method for the viewport box element mouse down event.
### onViewBoxMousemove(e)
> v0.10.2+
Call this method for the mouse movement event of the viewport box element.

View File

@@ -58,20 +58,31 @@ to the <code>miniMapContainer</code> element and set <code>miniMapContainer</cod
<p>At this point, when the mind map on the canvas changes, the small map will also
be updated in real time, and the view box element will reflect the position of
the viewport on the mind map graph in real time</p>
<p>6.Listen for the <code>mousedown</code>, <code>mousemove</code>, and <code>mouseup</code> events of the
<code>container</code> element, and call the three methods that will be introduced below to
achieve the effect of the mind map on the canvas being dragged with the mouse</p>
<p>6.Listen for the <code>mousedown</code>, <code>mousemove</code>events of the
<code>container</code> element, And listen for the 'mouseup' event of the 'window' (if 'mouseup' is bound to the 'container' element, the entire dragging behavior of the 'container' element cannot be stopped when the mouse is moved out), and call the three methods that will be introduced below to achieve the effect of the mind map on the canvas being dragged with the mouse</p>
<p>7.In v0.10.2+version, it supports dragging and dropping viewport boxes within the mini map to achieve synchronized dragging of the canvas, Implementing this feature can listen to the 'mousedown' of the 'viewBoxContainer' elementNeed to prevent bubbles, otherwise it will trigger the 'mousedown' event of the 'container' element<code>mousemove</code> event, Call the 'onViewBoxMousedown' and 'onViewBoxMousemove' methods of the mini map plugin instance separately, At the same time, it is necessary to listen for the 'mini_map_view_box_position_change' event to update the viewBoxContainer element in real-time</p>
<p>For detailed tutorials, please refer to<a href="https://wanglin2.github.io/mind-map/#/doc/zh/course14">How to render a mini map</a></p>
<h3>onMousedown(e)</h3>
<p>Small map mouse down event executes this function</p>
<p>Small map mouse down event executes this function.</p>
<p><code>e</code>: event object</p>
<h3>onMousemove(e, sensitivityNum = 5)</h3>
<p>This function is executed on the small map mouse move event.</p>
<p><code>e</code>: event object</p>
<p><code>sensitivityNum</code>: drag sensitivity, the higher the sensitivity, the greater the
actual canvas dragging distance on the small map when dragging the same distance
on the small map</p>
on the small map.</p>
<h3>onMouseup()</h3>
<p>This function is executed on the small map mouse release event.</p>
<h3>onViewBoxMousedown(e)</h3>
<blockquote>
<p>v0.10.2+</p>
</blockquote>
<p>Call this method for the viewport box element mouse down event.</p>
<h3>onViewBoxMousemove(e)</h3>
<blockquote>
<p>v0.10.2+</p>
</blockquote>
<p>Call this method for the mouse movement event of the viewport box element.</p>
</div>
</template>

View File

@@ -0,0 +1,89 @@
# OuterFrame plugin
> v0.10.2+
This plugin is used to implement bounding box functionality.
## Register
```js
import MindMap from 'simple-mind-map'
import OuterFrame from 'simple-mind-map/src/plugins/OuterFrame.js'
MindMap.usePlugin(OuterFrame)
```
After registration and instantiation of `MindMap`, the instance can be obtained through `mindMap.outerFrame`.
The application can refer to the code in this section of the demo: [NodeOuterFrame.vue](https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/NodeOuterFrame.vue)。
## Command
This plugin will register the 'ADD_OUTER_FRAME' command with the mind map to add bounding boxes to nodes:
```js
mindMap.execCommand('ADD_OUTER_FRAME', appointNodes, config = {})
```
- `appointNodes`Specify the node instance node to add the bounding box to, which can be a single node instance or an array of node instances. If passing '[]' or 'null', the bounding box will be added to the currently active node on the canvas
- `config`Outline configuration, object format, and fields are as follows:
| Field | Type | Default | Desc |
| ------------------ | ------- | --------------- | ------------|
| radius | Number | 5 | Size of rounded corners on the outer frame |
| strokeWidth | Number | 2 | Outer border width |
| strokeColor | String | #0984e3 | Outer border color |
| strokeDasharray | String | 5,5 | Outer border dashed line |
| fill | String | rgba(9,132,227,0.05) | Outer frame fill color |
## Event
### outer_frame_active
Triggered when clicking to activate a certain bounding box. The callback function takes three parameters: elOuter frame elements,The rect element of library @svgdotjs/svg.js, nodeThe parent node instance of the node to which this scope belongs, rangeRange interval, relative to node
The application can listen to this event to retrieve the currently activated bounding box, retrieve its configuration, and echo it to the page. Since the scope may contain multiple nodes, the first node instance is usually taken. If you want to retrieve the position of the bounding box on the page, you can call the 'el.rbox' method:
```js
mindMap.on('outer_frame_active', (el, parentNode, range) => {
// Take the bounding box style of the first node within the range
const firstNode = parentNode.children[range[0]]
const firstNodeOuterFrame = firstNode.getData('outerFrame')
// Obtain the position and size information of the bounding box, where you can render your configuration float layer
const { x, y, width, height } = el.rbox()
})
```
### outer_frame_delete
Triggered when deleting the currently active bounding box on the canvas.
## Methods
### getActiveOuterFrame()
Get the currently activated bounding box data. Return an object with the following structure:
```js
{
el,
node,
range
}
```
### updateActiveOuterFrame(config = {})
Update the currently active bounding box. After executing this method, please immediately hide your style panel as it will clear the currently active bounding box.
### removeActiveOuterFrame()
Delete the currently active bounding box.
### getRangeNodeList(node, range)
Get a list of boxed child nodes within a specified range of a node.
### clearActiveOuterFrame()
Clear the currently active bounding box.

View File

@@ -0,0 +1,112 @@
<template>
<div>
<h1>OuterFrame plugin</h1>
<blockquote>
<p>v0.10.2+</p>
</blockquote>
<p>This plugin is used to implement bounding box functionality.</p>
<h2>Register</h2>
<pre class="hljs"><code><span class="hljs-keyword">import</span> MindMap <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;simple-mind-map&#x27;</span>
<span class="hljs-keyword">import</span> OuterFrame <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;simple-mind-map/src/plugins/OuterFrame.js&#x27;</span>
MindMap.usePlugin(OuterFrame)
</code></pre>
<p>After registration and instantiation of <code>MindMap</code>, the instance can be obtained through <code>mindMap.outerFrame</code>.</p>
<p>The application can refer to the code in this section of the demo: <a href="https://github.com/wanglin2/mind-map/blob/main/web/src/pages/Edit/components/NodeOuterFrame.vue">NodeOuterFrame.vue</a></p>
<h2>Command</h2>
<p>This plugin will register the 'ADD_OUTER_FRAME' command with the mind map to add bounding boxes to nodes:</p>
<pre class="hljs"><code>mindMap.execCommand(<span class="hljs-string">&#x27;ADD_OUTER_FRAME&#x27;</span>, appointNodes, config = {})
</code></pre>
<ul>
<li>
<p><code>appointNodes</code>Specify the node instance node to add the bounding box to, which can be a single node instance or an array of node instances. If passing '[]' or 'null', the bounding box will be added to the currently active node on the canvas</p>
</li>
<li>
<p><code>config</code>Outline configuration, object format, and fields are as follows:</p>
</li>
</ul>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Default</th>
<th>Desc</th>
</tr>
</thead>
<tbody>
<tr>
<td>radius</td>
<td>Number</td>
<td>5</td>
<td>Size of rounded corners on the outer frame</td>
</tr>
<tr>
<td>strokeWidth</td>
<td>Number</td>
<td>2</td>
<td>Outer border width</td>
</tr>
<tr>
<td>strokeColor</td>
<td>String</td>
<td>#0984e3</td>
<td>Outer border color</td>
</tr>
<tr>
<td>strokeDasharray</td>
<td>String</td>
<td>5,5</td>
<td>Outer border dashed line</td>
</tr>
<tr>
<td>fill</td>
<td>String</td>
<td>rgba(9,132,227,0.05)</td>
<td>Outer frame fill color</td>
</tr>
</tbody>
</table>
<h2>Event</h2>
<h3>outer_frame_active</h3>
<p>Triggered when clicking to activate a certain bounding box. The callback function takes three parameters: elOuter frame elements,The rect element of library @svgdotjs/svg.js, nodeThe parent node instance of the node to which this scope belongs, rangeRange interval, relative to node</p>
<p>The application can listen to this event to retrieve the currently activated bounding box, retrieve its configuration, and echo it to the page. Since the scope may contain multiple nodes, the first node instance is usually taken. If you want to retrieve the position of the bounding box on the page, you can call the 'el.rbox' method:</p>
<pre class="hljs"><code>mindMap.on(<span class="hljs-string">&#x27;outer_frame_active&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">el, parentNode, range</span>) =&gt;</span> {
<span class="hljs-comment">// Take the bounding box style of the first node within the range</span>
<span class="hljs-keyword">const</span> firstNode = parentNode.children[range[<span class="hljs-number">0</span>]]
<span class="hljs-keyword">const</span> firstNodeOuterFrame = firstNode.getData(<span class="hljs-string">&#x27;outerFrame&#x27;</span>)
<span class="hljs-comment">// Obtain the position and size information of the bounding box, where you can render your configuration float layer</span>
<span class="hljs-keyword">const</span> { x, y, width, height } = el.rbox()
})
</code></pre>
<h3>outer_frame_delete</h3>
<p>Triggered when deleting the currently active bounding box on the canvas.</p>
<h2>Methods</h2>
<h3>getActiveOuterFrame()</h3>
<p>Get the currently activated bounding box data. Return an object with the following structure:</p>
<pre class="hljs"><code>{
el,
node,
range
}
</code></pre>
<h3>updateActiveOuterFrame(config = {})</h3>
<p>Update the currently active bounding box. After executing this method, please immediately hide your style panel as it will clear the currently active bounding box.</p>
<h3>removeActiveOuterFrame()</h3>
<p>Delete the currently active bounding box.</p>
<h3>getRangeNodeList(node, range)</h3>
<p>Get a list of boxed child nodes within a specified range of a node.</p>
<h3>clearActiveOuterFrame()</h3>
<p>Clear the currently active bounding box.</p>
</div>
</template>
<script>
export default {
}
</script>
<style>
</style>

View File

@@ -148,13 +148,13 @@ Move a node in front of another node.
Move a node behind another node.
### moveNodeToCenter(node)
### moveNodeToCenter(node, resetScale)
> v0.2.17+
Move a node to the center of the canvas.
- `resetScale`: v0.10.1+, Specify whether to reset the canvas scaling value to 100%. When you do not explicitly pass it, the default value is undefined, because the resetScaleOnMoveNodeToCenter configuration of the instantiation option also determines whether to reset scaling. Therefore, use the resetScaleOnMoveNodeToCenter configuration when you do not explicitly pass it, otherwise use the resetScale configuration
Currently, if there is zoom, returning to the center will reset the zoom.
Move a node to the center of the canvas.
### expandToNodeUid(uid, callback)

Some files were not shown because too many files have changed in this diff Show More