antvis/G6

Using iconSrc and iconRadius in the force layout causes images to not appear when clicked #6419

oxidums posted onGitHub

Describe the bug / 问题描述

在 force 布局中使用 iconSrc 和 iconRadius 属性, 在拖动节点或者选中节点的时候,图片会消失

No response

Steps to Reproduce the Bug or Issue / 重现步骤

https://g6-next.antv.antgroup.com/zh/examples/layout/force-directed/#force 在示例中插入以下代码会复现

import { Graph } from '@antv/g6';

fetch('https://assets.antv.antgroup.com/g6/cluster.json')
  .then((res) => res.json())
  .then((data) => {
    const graph = new Graph({
      container: 'container',
      data,
      node: {
        type: 'circle',
        style: {
          size: 40,
          iconSrc: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ',
          iconWidth: 40,
          iconHeight: 40,
          iconRadius: 20
        }
      },
      layout: {
        type: 'force',
        linkDistance: 50,
      },
      behaviors: ['drag-element', 'drag-canvas', 'click-select', 'zoom-canvas'],
    });

    graph.render();
  });

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome, Edge

Additional context / 补充说明

No response


相关问题已修复

posted by Aarebecca 5 months ago

Fund this Issue

$0.00
Funded

Pull requests