antvis / g6-editor

532 stars 172 forks source link

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

Open gzhanghui opened 5 years ago

gzhanghui commented 5 years ago
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] // 下边边的中点

  ]
gzhanghui commented 5 years ago

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

 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"]
                    ]
                }
...
}