g6-editor icon indicating copy to clipboard operation
g6-editor copied to clipboard

通过npm安装的包 添加anchor为菱形不生效?

Open zhanghui-space opened this issue 6 years ago • 1 comments

var modelInputNodeCfg = {
 shape: 'marker', // 可选值 marker,image
 symbol: 'diamond', // square: diamond:  triangle:  "triangle-down"
 type: 'input',
 style: {
   // fill: 'red',
   // fillOpacity: 1,
   // stroke: 'blue'
 }
};
// 设置锚点
 anchor: [
   [0.5, 0,modelInputNodeCfg ], // 上面边的中点
   [0.5, 1] // 下边边的中点

 ]

zhanghui-space avatar Jul 21 '19 07:07 zhanghui-space

把源码格式化后看到源码中是有备选项的,就是不知道怎么设置

 u.Symbols = {
                circle: function(t, e, n) {
                   /* return [
                        ["M", t, e],
                        ["m", -n, 0],
                        ["a", n, n, 0, 1, 0, 2 * n, 0],
                        ["a", n, n, 0, 1, 0, 2 * -n, 0]
                    ]*/
                    return [
                       ["M", t - n, e],
                        ["L", t, e - n],
                        ["L", t + n, e],
                        ["L", t, e + n],
                        ["Z"]
                    ]
                },
                square: function(t, e, n) {
                    return [
                        ["M", t - n, e - n],
                        ["L", t + n, e - n],
                        ["L", t + n, e + n],
                        ["L", t - n, e + n],
                        ["Z"]
                    ]
                },
                diamond: function(t, e, n) {
                    return [
                        ["M", t - n, e],
                        ["L", t, e - n],
                        ["L", t + n, e],
                        ["L", t, e + n],
                        ["Z"]
                    ]
                }
...
}

zhanghui-space avatar Jul 21 '19 13:07 zhanghui-space