antvis/G6

Adding edge by clicking on context menu #4703

dgdagadin1987 posted onGitHub

问题描述

Good day.

I should create edge. To do this, I should click on node context menu item "Add edge". Then, I set graph mode to 'create-edge'. Then, I should click to source node, and then the creating edge appears and I should drag the cursor to target node.

But I want to do like that: I click on node context menu item "Add edge", and THEN the creating edge appears from the node, which context menu item I clicked, and I only drag it to the target node.

I tried

graph.setState(nodeItem, 'selected', true); or

const bBox = nodeItem.getBBox();
document.elementFromPoint(bBox.centerX, bBox.centerY).click()

But it doesn't work as I need.

Is it possible to do what I want?

重现链接

https://codesandbox.io/s/new

重现步骤

  1. Enter the page
  2. Click right mouse button on node
  3. Click on context menu item "Add edge"

预期行为

I should create edge. To do this, I should click on node context menu item "Add edge". Then, I set graph mode to 'create-edge'. Then, I should click to source node, and then the creating edge appears and I should drag the cursor to target node.

But I want to do like that: I click on node context menu item "Add edge", and THEN the creating edge appears from the node, which context menu item I clicked, and I only drag it to the target node.

平台

  • 操作系统: Windows 10
  • 网页浏览器: Google Chrome
  • G6 版本: 4.8.17

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


graph.emit('node:click', {item: item})

posted by dgdagadin1987 almost 2 years ago

Fund this Issue

$0.00
Funded

Pull requests