【问题标题】:Suppress mouseover during click and drag in d3在 d3 中单击并拖动时抑制鼠标悬停
【发布时间】:2013-07-08 02:43:59
【问题描述】:

我在鼠标悬停时发生的 d3 可视化中有某种行为。这是一个force layout,具有可以单击和拖动的元素。现在,如果我在拖动另一个元素时将鼠标悬停在一个元素上,则会触发鼠标悬停行为。我想在拖动时抑制它。如何使一个事件的行为以另一事件的状态为条件?

现在的代码如下所示:

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
  });

【问题讨论】:

    标签: javascript d3.js


    【解决方案1】:

    显然问题与强制布局的这种行为有关:Dragging on force layout prevents other mouseup listeners

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-10
      • 2015-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多