Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc1cf71eaa | ||
|
|
d929792157 | ||
|
|
658b47b72e | ||
|
|
591e6a5b2a | ||
|
|
58baf4c0aa | ||
|
|
00f86fe167 | ||
|
|
5c1e5f072c | ||
|
|
b45674cf8f | ||
|
|
c23a16e65a | ||
|
|
b7722987b1 | ||
|
|
1fc5b951a0 | ||
|
|
53eb608007 | ||
|
|
876afb2504 | ||
|
|
4d1608e8c4 | ||
|
|
80f45e5e7d | ||
|
|
f80317a449 | ||
|
|
9bce6d3ded | ||
|
|
16e40b4342 | ||
|
|
624203ea84 | ||
|
|
6ffa4570d4 | ||
|
|
d99a4dcc33 | ||
|
|
e8c4aad690 | ||
|
|
35c8e129f0 | ||
|
|
dc096fd535 | ||
|
|
a047dabbd0 | ||
|
|
1ec723db0e | ||
|
|
d9fc209dac | ||
|
|
8647cb5893 | ||
|
|
264875e14e | ||
|
|
de423f3bd3 | ||
|
|
fcdcda929c | ||
|
|
1cfd50a42b | ||
|
|
f794df4e6f | ||
|
|
eea1109e43 | ||
|
|
65004d08cd | ||
|
|
44d75ef7f4 | ||
|
|
1f473b79e9 | ||
|
|
8ad26da5d7 | ||
|
|
e7f1608605 | ||
|
|
d14fb0b666 | ||
|
|
a55401de23 | ||
|
|
a9ad38e39b | ||
|
|
4f5746680d | ||
|
|
b7d906d1ea | ||
|
|
1181871772 | ||
|
|
93df2d7950 | ||
|
|
09633dda58 |
36
README.md
@@ -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>
|
||||
|
||||
2
copy.js
@@ -13,4 +13,4 @@ if (fs.existsSync(src)) {
|
||||
fs.unlinkSync(src)
|
||||
}
|
||||
|
||||
console.warn('请检查手绘风格选项是否开启!!!')
|
||||
console.warn('请检查手绘风格、标记插件是否启用!!!')
|
||||
2
dist/css/app.css
vendored
BIN
dist/fonts/iconfont.ttf
vendored
BIN
dist/fonts/iconfont.woff
vendored
BIN
dist/fonts/iconfont.woff2
vendored
0
dist/img/孟照星.jpg → dist/img/Alex.jpg
vendored
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
BIN
dist/img/Kyle.jpg
vendored
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
dist/img/buddy.jpg
vendored
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
dist/img/logicalStructureLeft.jpg
vendored
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
dist/img/好名字.jpg
vendored
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
dist/img/木木.jpg
vendored
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
dist/img/标记.jpg
vendored
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
dist/img/秀树因馨雨.jpg
vendored
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
dist/img/错误.jpg
vendored
Normal file
|
After Width: | Height: | Size: 60 KiB |
2
dist/js/app.js
vendored
1
dist/js/chunk-02087b0a.js
vendored
Normal file
2
dist/js/chunk-2d0a3179.js
vendored
2
dist/js/chunk-2d0ab10b.js
vendored
2
dist/js/chunk-2d0abe0f.js
vendored
@@ -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
2
dist/js/chunk-2d0c191e.js
vendored
2
dist/js/chunk-2d0d9fbc.js
vendored
2
dist/js/chunk-2d0da701.js
vendored
2
dist/js/chunk-2d0dad5f.js
vendored
2
dist/js/chunk-2d0db0f2.js
vendored
@@ -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}}]);
|
||||
2
dist/js/chunk-2d0dddce.js
vendored
@@ -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}}]);
|
||||
2
dist/js/chunk-2d0e5089.js
vendored
@@ -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}}]);
|
||||
2
dist/js/chunk-2d0e9742.js
vendored
2
dist/js/chunk-2d0f026c.js
vendored
2
dist/js/chunk-2d208ffa.js
vendored
2
dist/js/chunk-2d20f68f.js
vendored
2
dist/js/chunk-2d210a7a.js
vendored
1
dist/js/chunk-2d21e7f1.js
vendored
Normal file
2
dist/js/chunk-2d2254a4.js
vendored
1
dist/js/chunk-337a3983.js
vendored
1
dist/js/chunk-428b560e.js
vendored
Normal file
1
dist/js/chunk-6fd88c2d.js
vendored
Normal file
1
dist/js/chunk-bb91a162.js
vendored
@@ -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>
|
||||
@@ -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
|
||||
|
||||
@@ -518,7 +518,6 @@ class MindMap {
|
||||
// 恢复原先的大小和变换信息
|
||||
svg.size(origWidth, origHeight)
|
||||
draw.transform(origTransform)
|
||||
|
||||
return {
|
||||
svg: clone, // 思维导图图形的整体svg元素,包括:svg(画布容器)、g(实际的思维导图组)
|
||||
svgHTML: clone.svg(), // svg字符串
|
||||
|
||||
4
simple-mind-map/package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "simple-mind-map",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.2",
|
||||
"description": "一个简单的web在线思维导图",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -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'
|
||||
]
|
||||
|
||||
// 错误类型
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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>`))
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
391
simple-mind-map/src/plugins/OuterFrame.js
Normal 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
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -38,6 +38,7 @@ function createOneControlNode(pointKey) {
|
||||
// 控制点的鼠标按下事件
|
||||
function onControlPointMousedown(e, pointKey) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
this.isControlPointMousedown = true
|
||||
this.mousedownControlPointKey = pointKey
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
57
simple-mind-map/src/utils/AutoMove.js
Normal 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
|
||||
@@ -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) {
|
||||
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
BIN
web/src/assets/avatar/Kyle.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
web/src/assets/avatar/buddy.jpg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
web/src/assets/avatar/lsytyrt.jpg
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
web/src/assets/avatar/好名字.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
web/src/assets/avatar/木木.jpg
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
web/src/assets/avatar/秀树因馨雨.jpg
Normal file
|
After Width: | Height: | Size: 68 KiB |
@@ -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";
|
||||
}
|
||||
|
||||
BIN
web/src/assets/img/docs/标记.jpg
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
web/src/assets/img/docs/错误.jpg
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
web/src/assets/img/structures/logicalStructureLeft.jpg
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
@@ -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'
|
||||
]
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ export const shortcutKeyList = [
|
||||
{
|
||||
icon: 'icontianjiazijiedian',
|
||||
name: 'Inert child node',
|
||||
value: 'Tab'
|
||||
value: 'Tab | Insert'
|
||||
},
|
||||
{
|
||||
icon: 'iconjiedian',
|
||||
|
||||
@@ -273,7 +273,7 @@ export const shortcutKeyList = [
|
||||
{
|
||||
icon: 'icontianjiazijiedian',
|
||||
name: '插入下级节点',
|
||||
value: 'Tab'
|
||||
value: 'Tab | Insert'
|
||||
},
|
||||
{
|
||||
icon: 'iconjiedian',
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: '填充颜色'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ let APIList = [
|
||||
'rainbowLines',
|
||||
'handDrawnLikeStyle',
|
||||
'demonstrate',
|
||||
'notation',
|
||||
'outerFrame',
|
||||
'xmind',
|
||||
'markdown',
|
||||
'utils'
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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."</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>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const mindMap = new MindMap({
|
||||
| -------------------------------- | ------- | ---------------- | ------------------------------------------- | -------- |
|
||||
| el | Element | | Container element, must be a DOM element(When 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)、timeline(v0.5.4+, timeline)、timeline2(v0.5.4+, up down alternating timeline)、fishbone(v0.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)、timeline(v0.5.4+, timeline)、timeline2(v0.5.4+, up down alternating timeline)、fishbone(v0.5.4+, fishbone diagram) | |
|
||||
| fishboneDeg(v0.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({
|
||||
| handleNodePasteImg(v0.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} } | |
|
||||
| isLimitMindMapInCanvas(v0.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 | |
|
||||
| beforeShortcutRun(v0.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: key(Shortcut key)、activeNodeList(List of currently activated nodes) | |
|
||||
| resetScaleOnMoveNodeToCenter(v0.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 operations(The underlying impact is on the moveNodeToCenter method of the render class) | |
|
||||
| resetScaleOnMoveNodeToCenter(v0.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 operations(This 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) | |
|
||||
| createNodePrefixContent(v0.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 | |
|
||||
| createNodePostfixContent(v0.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 | |
|
||||
| disabledClipboard(v0.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 | |
|
||||
| customHyperlinkJump(v0.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: link(The URL of the hyperlink)、node(Node 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
|
||||
| minExportImgCanvasScale(v0.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 | |
|
||||
| addContentToHeader(v0.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 | |
|
||||
| addContentToFooter(v0.9.9+) | Function、null | null | The basic definition is the same as addContentToHeader, adding custom content at the end | |
|
||||
| handleBeingExportSvg(v0.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({
|
||||
| dragPlaceholderRectFill(v0.7.2+) | String | rgb(94, 200, 248) | The filling color of the schematic rectangle for the new position when dragging nodes. | |
|
||||
| dragPlaceholderLineConfig(v0.10.0+) | Object | { color: 'rgb(94, 200, 248)', width: 2 } | Style configuration of schematic lines for new positions when dragging nodes | |
|
||||
| dragOpacityConfig(v0.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 | |
|
||||
| beforeDragEnd(v0.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 | |
|
||||
| handleDragCloneNode(v0.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) | |
|
||||
| beforeDragStart(v0.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 |
|
||||
| -------------------------------- | ------- | ---------------- | ------------------------------------------- | -------- |
|
||||
| disableTouchZoom(v0.8.1+) | Boolean | false | Prohibit double finger scaling, you can still use the API for scaling, which takes effect on the TouchEvent plugin | |
|
||||
| minTouchZoomScale(v0.10.1+) | Number | 20 | Allow maximum and minimum scaling values, percentage, pass -1 to indicate no restrictions | |
|
||||
| maxTouchZoomScale(v0.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) 、node(v0.10.2+, Node instance for current text editing) |
|
||||
| scale | Canvas zoom event | scale (zoom ratio) |
|
||||
| translate(v0.9.10+) | Canvas movement event | x(translate x)、y(translate y) |
|
||||
| node_img_dblclick(v0.2.15+) | Node image double-click event | this (node instance), e (event object) |
|
||||
@@ -579,6 +587,9 @@ Listen to an event. Event list:
|
||||
| exit_demonstrate(v0.9.11+) | Triggered when exiting demonstration mode | |
|
||||
| demonstrate_jump(v0.9.11+) | Trigger when switching steps in demonstration mode | currentStepIndex(The index of the steps currently played, counting from 0)、stepLength(Total number of playback steps) |
|
||||
| node_tag_click(v0.9.12+) | Click events on node labels | this(Current node instance)、item(Content of clicked tags) |
|
||||
| node_layout_end(v0.10.1+) | Event where the content layout of a single node is completed | this(Current node instance) |
|
||||
| node_attachmentClick(v0.9.10+) | Click event for node attachment icon | this(Current node instance)、e(Event Object)、node(Icon node) |
|
||||
| node_attachmentContextmenu(v0.9.10+) | Right click event on node attachment icon | this(Current node instance)、e(Event Object)、node(Icon node) |
|
||||
|
||||
### emit(event, ...args)
|
||||
|
||||
|
||||
@@ -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)、timeline(v0.5.4+, timeline)、timeline2(v0.5.4+, up down alternating timeline)、fishbone(v0.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)、timeline(v0.5.4+, timeline)、timeline2(v0.5.4+, up down alternating timeline)、fishbone(v0.5.4+, fishbone diagram)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -502,7 +502,7 @@
|
||||
<td>resetScaleOnMoveNodeToCenter(v0.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 operations(The 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 operations(This 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>disabledClipboard(v0.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>customHyperlinkJump(v0.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: link(The URL of the hyperlink)、node(Node 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>handleBeingExportSvg(v0.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>beforeDragEnd(v0.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>handleDragCloneNode(v0.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>beforeDragStart(v0.10.2+)</td>
|
||||
<td>null、Function((nodeList) => {})</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>minTouchZoomScale(v0.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>maxTouchZoomScale(v0.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) 、node(v0.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)、item(Content of clicked tags)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>node_layout_end(v0.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_attachmentClick(v0.9.10+)</td>
|
||||
<td>Click event for node attachment icon</td>
|
||||
<td>this(Current node instance)、e(Event Object)、node(Icon node)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>node_attachmentContextmenu(v0.9.10+)</td>
|
||||
<td>Right click event on node attachment icon</td>
|
||||
<td>this(Current node instance)、e(Event Object)、node(Icon node)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3>emit(event, ...args)</h3>
|
||||
|
||||
@@ -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:
|
||||
|
||||
> RichText(Node Rich Text Plugin)、Select(Mouse Multiple Selection Node Plugin)、Drag(Node drag plugin)、AssociativeLine(Associate Line Plugin)、Export(Export plugin)、KeyboardNavigation(Keyboard navigation plugin)、MiniMap(Mini Map Plugin)、Watermark(Watermark plugin)、TouchEvent(Mobile touch event support plugin)、NodeImgAdjust(Drag and adjust node image size plugin)、Search(Search plugin)、Painter(Node Format Brush Plugin)、Scrollbar(Scroll bar plugin)、Formula(Mathematical Formula Plugin)、Cooperate(Collaborative editing plugin)、RainbowLines(Rainbow Line Plugin)、Demonstrate(Demonstration mode plugin)、HandDrawnLikeStyle(Hand drawn style plugin)[收费]
|
||||
> RichText(Node Rich Text Plugin)、Select(Mouse Multiple Selection Node Plugin)、Drag(Node drag plugin)、AssociativeLine(Associate Line Plugin)、Export(Export plugin)、KeyboardNavigation(Keyboard navigation plugin)、MiniMap(Mini Map Plugin)、Watermark(Watermark plugin)、TouchEvent(Mobile touch event support plugin)、NodeImgAdjust(Drag and adjust node image size plugin)、Search(Search plugin)、Painter(Node Format Brush Plugin)、Scrollbar(Scroll bar plugin)、Formula(Mathematical Formula Plugin)、Cooperate(Collaborative editing plugin)、RainbowLines(Rainbow Line Plugin)、Demonstrate(Demonstration mode plugin)、OuterFrame(Outer frame plugin)、HandDrawnLikeStyle(Hand drawn style plugin)[charge]、Notation(Node 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>
|
||||
|
||||
@@ -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>RichText(Node Rich Text Plugin)、Select(Mouse Multiple Selection Node Plugin)、Drag(Node drag plugin)、AssociativeLine(Associate Line Plugin)、Export(Export plugin)、KeyboardNavigation(Keyboard navigation plugin)、MiniMap(Mini Map Plugin)、Watermark(Watermark plugin)、TouchEvent(Mobile touch event support plugin)、NodeImgAdjust(Drag and adjust node image size plugin)、Search(Search plugin)、Painter(Node Format Brush Plugin)、Scrollbar(Scroll bar plugin)、Formula(Mathematical Formula Plugin)、Cooperate(Collaborative editing plugin)、RainbowLines(Rainbow Line Plugin)、Demonstrate(Demonstration mode plugin)、HandDrawnLikeStyle(Hand drawn style plugin)[收费]</p>
|
||||
<p>RichText(Node Rich Text Plugin)、Select(Mouse Multiple Selection Node Plugin)、Drag(Node drag plugin)、AssociativeLine(Associate Line Plugin)、Export(Export plugin)、KeyboardNavigation(Keyboard navigation plugin)、MiniMap(Mini Map Plugin)、Watermark(Watermark plugin)、TouchEvent(Mobile touch event support plugin)、NodeImgAdjust(Drag and adjust node image size plugin)、Search(Search plugin)、Painter(Node Format Brush Plugin)、Scrollbar(Scroll bar plugin)、Formula(Mathematical Formula Plugin)、Cooperate(Collaborative editing plugin)、RainbowLines(Rainbow Line Plugin)、Demonstrate(Demonstration mode plugin)、OuterFrame(Outer frame plugin)、HandDrawnLikeStyle(Hand drawn style plugin)[charge]、Notation(Node 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>
|
||||
|
||||
|
||||
@@ -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' element(Need 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.
|
||||
@@ -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' element(Need 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>
|
||||
|
||||
89
web/src/pages/Doc/en/outerFrame/index.md
Normal 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: el(Outer frame elements,The rect element of library @svgdotjs/svg.js), node(The parent node instance of the node to which this scope belongs), range(Range 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.
|
||||
112
web/src/pages/Doc/en/outerFrame/index.vue
Normal 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">'simple-mind-map'</span>
|
||||
<span class="hljs-keyword">import</span> OuterFrame <span class="hljs-keyword">from</span> <span class="hljs-string">'simple-mind-map/src/plugins/OuterFrame.js'</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">'ADD_OUTER_FRAME'</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: el(Outer frame elements,The rect element of library @svgdotjs/svg.js), node(The parent node instance of the node to which this scope belongs), range(Range 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">'outer_frame_active'</span>, <span class="hljs-function">(<span class="hljs-params">el, parentNode, range</span>) =></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">'outerFrame'</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>
|
||||
@@ -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)
|
||||
|
||||
|
||||