Skip to content

[Bug]: tooltip在设置只有node才能触发的情况下,鼠标移出节点后移入combo内提示不消失 #7362

@zmm2015

Description

@zmm2015

Describe the bug / 问题描述

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

const data = {
  nodes: [
    { id: 'node1', combo: 'combo1', style: { x: 250, y: 150 } },
    { id: 'node2', combo: 'combo1', style: { x: 350, y: 150 } },
    { id: 'node3', combo: 'combo2', style: { x: 250, y: 300 } },
  ],
  edges: [],
  combos: [{ id: 'combo1', combo: 'combo2' }, { id: 'combo2' }],
};

const graph = new Graph({
  container: 'container',
  data,
  node: {
    style: {
      labelText: (d) => d.id,
    },
  },
  combo: {
    type: 'circle',
  },
  behaviors: ['drag-element', 'collapse-expand'],
  plugins: [
    {
      type: 'tooltip',
      enable:({targetType})=>targetType==='node',
      getContent: ({ targetType }, items) => {
        let result = `<h4>Custom Content</h4>`;
        items.forEach((item) => {
          result += `<p>Type: ${item.id}</p>`;
        });
        return result;
      },
    },
  ],
});

graph.render();

Reproduction link / 复现链接

https://g6.antv.antgroup.com/examples/element/combo/#circle

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

官网combo示例中,添加以下代码能够复现

plugins: [
    {
      type: 'tooltip',
      enable:({targetType})=>targetType==='node',
      getContent: ({ targetType }, items) => {
        let result = `<h4>Custom Content</h4>`;
        items.forEach((item) => {
          result += `<p>Type: ${item.id}</p>`;
        });
        return result;
      },
    },
  ],

Version / 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Metadata

Metadata

Assignees

No one assigned

    Labels

    question 💬This issue is just a question. It will be converted into discussion automatically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions