Replies: 1 comment
-
To find out the port position of a node on the x and y axis on the canvas in AntV G6 version 5.x, you can follow these steps:
Here's a sample code snippet to illustrate the process: // Assuming you have the graph instance and the node ID
const nodeId = 'your-node-id';
const node = graph.findById(nodeId);
// Get the node's position
const model = node.getModel();
const nodeX = model.x;
const nodeY = model.y;
// Get the ports
const ports = node.getPorts();
// Calculate the absolute position of each port
ports.forEach(port => {
const portX = nodeX + port.x;
const portY = nodeY + port.y;
console.log(`Port position on canvas: (${portX}, ${portY})`);
}); This code will log the absolute position of each port on the canvas. Make sure to replace If you have any more questions or need further assistance, feel free to ask! 🪧 TipsFor further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me. |
Beta Was this translation helpful? Give feedback.
-
How to find out the port position of a node on the x and y axis on the canvas in version 5x
Beta Was this translation helpful? Give feedback.
All reactions