Feat:新增实例化时是否进行一次历史数据入栈操作的选项

This commit is contained in:
街角小林 2024-12-06 09:28:20 +08:00
parent 0a2e4e7c14
commit 74d302639a
4 changed files with 13 additions and 4 deletions

View File

@ -523,4 +523,8 @@ const mindMap = new MindMap({
<img src="./web/src/assets/avatar/4399行星元帅.jpg" style="width: 50px;height: 50px;" />
<span>4399行星元帅</span>
</span>
<span>
<img src="./web/src/assets/avatar/Xavier.png" style="width: 50px;height: 50px;" />
<span>Xavier</span>
</span>
</p>

View File

@ -123,9 +123,11 @@ class MindMap {
// 初始渲染
this.render(this.opt.fit ? () => this.view.fit() : () => {})
setTimeout(() => {
if (this.opt.data) this.command.addHistory()
}, 0)
// 将初始数据添加到历史记录堆栈中
if (this.opt.addHistoryOnInit && this.opt.data) {
this.command.addHistory()
}
}
// 配置参数处理
@ -574,7 +576,7 @@ class MindMap {
this.watermark.isInExport = false
}
// 添加必要的样式
;[this.joinCss(), ...cssTextList].forEach(s => {
[this.joinCss(), ...cssTextList].forEach(s => {
clone.add(SVG(`<style>${s}</style>`))
})
// 附加内容

View File

@ -265,6 +265,9 @@ export const defaultOpt = {
maxNodeTextModifyWidth: -1,
// 自定义处理节点的连线方法可以传递一个函数函数接收三个参数node节点实例、line节点的某条连线@svgjs库的path对象, { width, color, dasharray }dasharray该条连线的虚线样式为none代表实线你可以修改line对象来达到修改节点连线样式的效果比如增加流动效果
customHandleLine: null,
// 实例化完后是否立刻进行一次历史数据入栈操作
// 即调用mindMap.command.addHistory方法
addHistoryOnInit: true,
// 【Select插件】
// 多选节点时鼠标移动到边缘时的画布移动偏移量

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB