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

edge:added 事件里面 edge.target.cell取不到值 #3814

Closed
liu136149 opened this issue Jul 27, 2023 · 5 comments
Closed

edge:added 事件里面 edge.target.cell取不到值 #3814

liu136149 opened this issue Jul 27, 2023 · 5 comments

Comments

@liu136149
Copy link

问题描述

graph.on('edge:added', (item) => {
const edge = item.edge;
console.log(edge);
console.log(edge.source);
console.log(edge.target);
console.log(edge.target.cell);
})
新增一个edge后,source可以正常取到,target取到的值发生了变化

重现链接

https://x6.antv.vision/zh/examples/showcase/faq#validate-connection%E5%8F%AF%E5%A4%8D%E7%8E%B0%E9%97%AE%E9%A2%98

重现步骤

  1. 进入页面:https://x6.antv.vision/zh/examples/showcase/faq#validate-connection%E5%8F%AF%E5%A4%8D%E7%8E%B0%E9%97%AE%E9%A2%98
    2.把这串代码加到最后
    graph.on('edge:added', (item) => {
    const edge = item.edge;
    console.log(edge);
    console.log(edge.source);
    console.log(edge.target);
    console.log(edge.target.cell);
    })
    3.取到的target不符合预期 没有cell和port

预期行为

期望打印出的target对象是{cell: "xxx", port: "xxx"}
实际打印出来的target对象是{x: number, y: number}

平台

  • 操作系统: [win10]
  • 网页浏览器: [Google Chrome114.0.5735.199.]
  • X6 版本: [1.31.0]

屏幕截图或视频(可选)

image

补充说明(可选)

No response

@x6-bot
Copy link
Contributor

x6-bot bot commented Jul 27, 2023

👋 @liu136149

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@liu136149
Copy link
Author

console.log(edge.getTarget());
console.log(edge.getTargetCell());
console.log(edge.getTargetCellId())
console.log(edge.getTargetPortId());
这些方法也都无法顺利取到值
image

@cnyballk
Copy link
Contributor

cnyballk commented Jul 27, 2023

那是创建开始触发的,所以没有,你可以监听 edge:connected 事件

@liu136149
Copy link
Author

那是创建开始触发的,所以没有,你可以监听 edge:connected 事件

好的 谢谢

@x6-bot
Copy link
Contributor

x6-bot bot commented Aug 7, 2024

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Aug 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants