antvis/G6

Do you want to work on this issue?

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

[Bug]: Blank space selection in brush-select event causes all edges to be selected #6695

uioonm posted onGitHub

Describe the bug / 问题描述

https://github.com/user-attachments/assets/e6fc38b6-3edd-40e3-9f8f-398a53580a67

https://codesandbox.io/p/sandbox/quirky-swanson-t7zd39?file=%2Findex.js%3A75%2C8

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

相关代码

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

const graph = new Graph({
  autoResize: true,
  container: "container",
  autoFit: "view",
  data: {
    nodes: [
      {
        id: "station1",
        style: {
          x: 573,
          y: 484,
        },
      },
      {
        id: "station2",
        style: {
          x: -542.063,
          y: -18.6858,
        },
      },
      {
        id: "station3",
        style: {
          x: 595,
          y: 115,
        },
      },
      {
        id: "station4",
        style: {
          x: -559.514,
          y: 907.692,
        },
      },
      {
        id: "station5",
        style: {
          x: -541.296,
          y: 462.602,
        },
      },
      {
        id: "station6",
        style: {
          x: -141.418,
          y: 504.86,
        },
      },
      {
        id: "station7",
        style: {
          x: 84.5717,
          y: 918.536,
        },
      },
    ],
    edges: [
      {
        id: "crossStationLine1",
        source: "station3",
        target: "station1",
      },
      {
        id: "crossStationLine2",
        source: "station4",
        target: "station7",
      },
      {
        id: "crossStationLine3",
        source: "station2",
        target: "station5",
      },
      {
        id: "crossStationLine4",
        source: "station1",
        target: "station7",
      },
    ],
  },
  behaviors: [
    "zoom-canvas",
    "drag-element",
    {
      type: "drag-canvas",
      enable: (event) =>
        event.targetType === "canvas" && event.ctrlKey === false,
    },
    {
      key: "click-select",
      type: "click-select",
      trigger: ["control"],
      multiple: true,
      enable: (event) =>
        event.targetType === "node" || event.targetType === "edge",
    },
    {
      key: "brush-select",
      type: "brush-select",
      trigger: "control",
      enableElements: ["node", "edge"],
    },
  ],
});

graph.render();

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

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

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests