mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
Feat:expandBtnNumHandler选项新增节点实例的回调参数
This commit is contained in:
parent
c8d5a34640
commit
8f8c6c9d95
@ -67,9 +67,7 @@ export const defaultOpt = {
|
||||
close: ''
|
||||
},
|
||||
// 处理收起节点数量
|
||||
expandBtnNumHandler: num => {
|
||||
return num
|
||||
},
|
||||
expandBtnNumHandler: null,
|
||||
// 是否显示带数量的收起按钮
|
||||
isShowExpandNum: true,
|
||||
// 是否只有当鼠标在画布内才响应快捷键事件
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import btnsSvg from '../../../svg/btns'
|
||||
import { SVG, Circle, G, Text } from '@svgdotjs/svg.js'
|
||||
import { isUndef } from '../../../utils'
|
||||
|
||||
// 创建展开收起按钮的内容节点
|
||||
function createExpandNodeContent() {
|
||||
@ -78,7 +79,12 @@ function updateExpandBtnNode() {
|
||||
})
|
||||
// 计算子节点数量
|
||||
let count = this.sumNode(this.nodeData.children)
|
||||
count = expandBtnNumHandler(count)
|
||||
if (typeof expandBtnNumHandler === 'function') {
|
||||
const res = expandBtnNumHandler(count, this)
|
||||
if (!isUndef(res)) {
|
||||
count = res
|
||||
}
|
||||
}
|
||||
node.text(String(count))
|
||||
} else {
|
||||
this._fillExpandNode.stroke('none')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user