diff --git a/simple-mind-map/src/constants/defaultOptions.js b/simple-mind-map/src/constants/defaultOptions.js index 028201ed..3fd7be06 100644 --- a/simple-mind-map/src/constants/defaultOptions.js +++ b/simple-mind-map/src/constants/defaultOptions.js @@ -263,6 +263,8 @@ export const defaultOpt = { minNodeTextModifyWidth: 20, // 同minNodeTextModifyWidth,最大值,传-1代表不限制 maxNodeTextModifyWidth: -1, + // 自定义处理节点的连线方法,可以传递一个函数,函数接收三个参数:node(节点实例)、line(节点的某条连线,@svgjs库的path对象), { width, color, dasharray },dasharray(该条连线的虚线样式,为none代表实线),你可以修改line对象来达到修改节点连线样式的效果,比如增加流动效果 + customHandleLine: null, // 【Select插件】 // 多选节点时鼠标移动到边缘时的画布移动偏移量 diff --git a/simple-mind-map/src/core/render/node/Style.js b/simple-mind-map/src/core/render/node/Style.js index 8fc9d70d..ecd3d89d 100644 --- a/simple-mind-map/src/core/render/node/Style.js +++ b/simple-mind-map/src/core/render/node/Style.js @@ -278,6 +278,10 @@ class Style { // 连线 line(line, { width, color, dasharray } = {}, enableMarker, childNode) { + const { customHandleLine } = this.ctx.mindMap.opt + if (typeof customHandleLine === 'function') { + customHandleLine(this.ctx, line, { width, color, dasharray }) + } line.stroke({ color, dasharray, width }).fill({ color: 'none' }) // 可以显示箭头 if (enableMarker) {