【发布时间】:2018-07-20 06:12:04
【问题描述】:
我在获取边缘坐标 (x, y) 时遇到问题。
有什么解决办法吗?
cy.on('tap', function(e) {
if (e.cyTarget === cy) {
...
}
});
【问题讨论】:
标签: cytoscape.js
我在获取边缘坐标 (x, y) 时遇到问题。
有什么解决办法吗?
cy.on('tap', function(e) {
if (e.cyTarget === cy) {
...
}
});
【问题讨论】:
标签: cytoscape.js
您可以使用midpoint 方法获取边缘的模型位置坐标:
cy.on('tap', function(e){
// Checking if the target is not the background and if it is an edge
if(typeof e.cyTarget.isEdge !== 'undefined' && e.cyTarget.isEdge()) {
// Logging its position
console.log(e.cyTarget.midpoint());
}
});
更多关于midpoint方法的信息可以在here找到。
【讨论】: