0

我用的是AntV G6,遇到了一个问题。如何在画布上旋转元素并旋转锚点

G6.registerNode('rect-node', {
afterDraw(cfg, group) {
    const bbox = group.getBBox();
    const anchorPoints = this.getAnchorPoints(cfg)
    anchorPoints.forEach((anchorPos, i) => {
        group.addShape('circle', {
        });
    })
    group.addShape('ellipse', {
    });
},
getAnchorPoints(cfg) {
    return cfg.anchorPoints || [
        [0, 0.5],
        [1, 0.5],
    ];
},

并旋转组节点的元素

  rotate_element(graph, item) {
    const children = item.group.cfg.children;
    for (let i = 0; i < children.length; i++) {
        const child_item = children[i];
        child_item.rotate(Math.PI / 4)

    }

https://i.stack.imgur.com/dIaLi.png https://i.stack.imgur.com/LJqH8.png

如何旋转连接位置

4

0 回答 0