antvis/G6

Do you want to work on this issue?

You can request for a bounty in order to promote it!

自定义节点如何让主节点下通过addShape添加的图形支持create-edge #5778

LiZuoCan posted onGitHub

问题描述

树节点下通过addShape绘制节点的其他功能节点,我想让功能节点可以与其他节点建立关联

重现链接

重现步骤

预期行为

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [4.5.1 ... ]

屏幕截图或视频(可选)

Snipaste_2024-05-28_12-17-03

补充说明(可选)

No response


你可以参考一下我这个自定义边:
G6.registerEdge(
    "test-edge",
    {
      getLabelStyleByPosition(cfg, labelCfg, group) {
        const labelPosition = labelCfg.position || this.labelPosition;
        const style: LabelStyle = {};
        return style;
      },
      setState(name, value, item) {
        const group = item!.getContainer();
        if (value) {
          if (name === "inactive") {
            group.attr({
              opacity: 0.2,
            });
          }
        } else {
          group.attr({
            opacity: 1,
          });
        }
      },
    },
    "test"
  );
posted by longsfreedom 10 months ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests