[英]Suppress mouseover during click and drag in d3
I have a certain behavior in a d3 visualization that occurs on mouseover. 我在鼠标悬停时发生的d3可视化中有某种行为。 It's a force layout , with elements that can be clicked and dragged. 这是一种强制布局 ,其中的元素可以单击和拖动。 Right now if I mouseover one element while dragging another, the mouseover behavior is triggered. 现在,如果我将鼠标悬停在一个元素上而拖动另一个元素,则会触发鼠标悬停行为。 I want to suppress that while dragging. 我想在拖动时抑制它。 How can I make the behavior on one event conditional on the status of another event? 如何使一个事件的行为取决于另一事件的状态?
The code right now looks something like: 现在的代码如下所示:
selection
.call(force.drag) // allows you to drag and drop elements of the force layout
.on("mouseover", function() {
// behavior I want to suppress during click and drag
})
.on("mouseout", function() {
// return layout to pre-mouseover state
});
显然,问题与强制布局的这种行为有关: 在强制布局上拖动会阻止其他mouseup侦听器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.