8000 [Bug]: process-parallel-edges has strange behavior with collapsed combo · Issue #7168 · antvis/G6 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Bug]: process-parallel-edges has strange behavior with collapsed combo #7168
Open
@Rey-Wang

Description

@Rey-Wang

Describe the bug / 问题描述

When using process-parallel-edges and collapse-expand together, and there would be a loop edge is generated that can not be removed, and the edge label is displayed on the collapsed combo directly

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

const graph = new Graph({
  container: 'container',
  data: {
    nodes: [
      { id: 'node1', combo: 'combo1', style: { x: 300, y: 100 } },
      { id: 'node2', combo: 'combo1', style: { x: 300, y: 150 } },
      { id: 'node3', combo: 'combo2', style: { x: 100, y: 100 } },
      { id: 'node4', combo: 'combo2', style: { x: 50, y: 150 } },
      { id: 'node5', combo: 'combo2', style: { x: 150, y: 150 } },
    ],
    edges: [
      { source: 'node1', target: 'node2' },
      { source: 'node3', target: 'node4' },
      { source: 'node3', target: 'node5' },
    ],
    combos: [
      { id: 'combo1', style: { labelText: '双击折叠', collapsed: true } },
      { id: 'combo2', style: { labelText: '单击折叠', collapsed: false } },
    ],
  },
  edge: {
      type: 'quadratic',
      state: {
        highlighted: {
          stroke: '#F5AD21',
          labelFontWeight: 600,
          labelFontSize: 18,
        },
      },
      style: {
        loop: false,
        lineWidth: 2,
        haloOpacity: 0.2,
        endArrow: true,
        endArrowType: 'vee',
        stroke: '#C4CDE3',
        labelText: "this is text",
        labelFontSize: 14,
        labelFontWeight: 500,
        labelBackground: true,
        labelBackgroundFill: '#FFFFFF',
        labelBackgroundRadius: 4,
        labelPadding: [4, 8],
      },
    },
  transforms: [{
    type: 'process-parallel-edges',
    distance: 60,
  }],
  behaviors: [
    {
        type: 'drag-element',
      },
    {
      type: 'collapse-expand',
      trigger: 'dblclick',
      enable: (event) => event.targetType === 'combo' && event.target.id === 'combo1',
    },
    {
      type: 'collapse-expand',
      trigger: 'click',
      enable: (event) => event.targetType === 'combo' && event.target.id === 'combo2',
    },
  ],
});

graph.render();

Reproduction link / 复现链接

No response

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

No response

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

    bug 🐛Something isn't workinghelp wantedAnyone can help, whether you're a seasoned developer or new to the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0