Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加vertices工具后,边的点击事件失效 #3728

Closed
18839965530 opened this issue Jul 4, 2023 · 6 comments
Closed

添加vertices工具后,边的点击事件失效 #3728

18839965530 opened this issue Jul 4, 2023 · 6 comments

Comments

@18839965530
Copy link

Describe the bug

添加vertices工具后,边的点击事件失效

let graph = new Graph({
  container: this.container,
  height: 600,
  grid: {
    visible: true
  }
});

graph.addNode({
  x: 60,
  y: 50,
  shape: "my-rect",
  label: "In&Out Ports",
  ports: [
    {
      id: "port1",
      group: "in"
    },
    {
      id: "port2",
      group: "in"
    },
    {
      id: "port3",
      group: "in"
    },
    {
      id: "port4",
      group: "out"
    },
    {
      id: "port5",
      group: "out"
    }
  ]
});
graph.addNode({
  x: 60,
  y: 250,
  shape: "my-rect",
  label: "In&Out Ports",
  ports: [
    {
      id: "port1",
      group: "in"
    },
    {
      id: "port2",
      group: "in"
    },
    {
      id: "port3",
      group: "in"
    },
    {
      id: "port4",
      group: "out"
    },
    {
      id: "port5",
      group: "out"
    }
  ]
});
graph.on("edge:click", ({ e, x, y, cell, view }) => {
  alert('click')
});
graph.on("edge:mouseenter", ({ cell }) => {
  cell.addTools([
    {
      name: "vertices",
      args: {
        snapRadius: 20,
        stopPropagation:false,
        attrs: {
          fill: "#444"
        }
      }
    }
  ]);
});
graph.on("edge:mouseleave", ({ cell }) => {
  cell.removeTools();
});

Your Example Website or App

https://codesandbox.io/s/determined-rgb-z9vnsf?file=/src/app.tsx:898-2411

Steps to Reproduce the Bug or Issue

1.创建两个带连接桩的cell.
添加vertices工具后边的点击事2.为边绑定点击事件
3.为边添加小工具vertices
4.用边连接两个cell
5.点击新创建的边,点击事件没有执行。这个小工具添加之前是没问题的vertices,将stopPropagation设置为false也不行。

Expected behavior

期望stopPropagation能支持边的点击事件

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 2.11.1]
    win10 Chrome最新版

Additional context

No response

@NewByVector
Copy link
Contributor

可以使用 edge:mousedown 或者 edge:mouseup 事件来代替。

@18839965530
Copy link
Author

可以使用 edge:mousedown 或者 edge:mouseup 事件来代替。

我想要的效果是点击时执行点击的事件,拖动边的时候不执行,如果换成edge:mousedown 或者 edge:mouseup ,那么拖动边的时候就也会执行了

@apankun
Copy link

apankun commented Aug 1, 2023

我也遇到了一样的问题,请问最后是怎么解决的呢

@18839965530
Copy link
Author

我也遇到了一样的问题,请问最后是怎么解决的呢

暂无解决方案

@NewByVector
Copy link
Contributor

@18839965530 @apankun 在这个 PR 中修复。

@tiantianliulang
Copy link

奇怪,为什么我现在还会出现这样的问题,版本: 2.18.1 ,我看到这个BUG已经修复了啊!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants