我想回应针对力布局中节点的击键事件.我已经尝试添加我能想到的"击键","按键","键盘","键盘"的所有变体,但它们都没有发射.我的鼠标事件很好.我在d3源代码中找不到任何击键事件....有没有办法捕捉击键?
nodes.enter().append("circle")
.on("click", function(d) { return d.clickHandler(self); })
.on("mouseover", function(d) { return d.mouseOverHandler(self); })
.on("mouseout", function(d) { return d.mouseOutHandler(self); })
.on("keyup", function(d) {
console.log("keypress", d3.event); // also tried "keyup", "keydown", "key"
})
.classed("qNode", true)
.call(force.drag);
Run Code Online (Sandbox Code Playgroud)