我正在实现在 Shift+Alt+Click 上的两个节点之间创建链接的功能。像这样
function graphSelectionChange(event){
var selection = event.selection;
if (selection.length === 2 && event.altKey){
var fromitem=selection[0];
var toitem=selection[1];
chart.addData({
links:[{
"id":"ll"+nextId,
from:fromitem.id,
to:toitem.id,
"style":{"label":"newLink"}
}]
});
nextId += 1;
}
}
altKey 似乎没有被检测到。根据这个http://jsfiddle.net/Rw4km/它是键盘上的 alt/option 按钮。有什么线索吗?