G6 icon indicating copy to clipboard operation
G6 copied to clipboard

icon闪烁问题

Open xiaohun254700 opened this issue 1 year ago • 3 comments

问题描述

在G6中,鼠标移出的时候,icon图标会闪烁,我觉得好像是重新加载了一遍图片,能避免嘛?还是说就是G6的特性。

重现链接

https://g6.antv.antgroup.com/zh/examples/tree/customItemTree#customEdgeTree

重现步骤

1:进入页面。 2:鼠标移入icon。 3:鼠标移出icon。 4:会出现icon的闪烁问题。

预期行为

我希望看到icon或者图片不闪烁,但是实际上它是闪烁的

平台

  • 操作系统: Windows
  • 网页浏览器: Google
  • G6 版本: 4.8.17

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

xiaohun254700 avatar Jul 31 '23 06:07 xiaohun254700

还是没解决这个问题,有没有老哥有解决方案

xiaohun254700 avatar Sep 20 '23 10:09 xiaohun254700

可以给图形元素的的img属性传入一个Image对象

const iconImage = new Image()

iconImage.src = 'https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*Q_FQT6nwEC8AAAAAAAAAAABkARQnAQ'

// ...
 group.addShape('image', {
          attrs: {
            x: 8 - w / 2,
            y: 8 - h / 2,
            width: 24,
            height: 24,
            img: iconImage
          },
          // must be assigned in G6 3.3 and later versions. it can be any string you want, but should be unique in a custom item type
          name: 'image-shape',
});

nieyuyao avatar Jan 08 '24 09:01 nieyuyao

我也遇到了

manmanhunhun avatar May 15 '24 09:05 manmanhunhun

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

github-actions[bot] avatar Jul 05 '24 05:07 github-actions[bot]