Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
D3.js:快速鼠标交互导致视图不正确_D3.js - Fatal编程技术网

D3.js:快速鼠标交互导致视图不正确

D3.js:快速鼠标交互导致视图不正确,d3.js,D3.js,每当我真的很快地将鼠标移到元素上时,最终的结果是不可预测的 在D3中有没有一种分层转换的方法可以防止这个问题,或者这只是你必须解决的问题 是否需要将元素放置得更远 我还尝试使用mousemove,这样在元素上不断移动会将其刷新到正确的状态,但元素会随着移动而变大(即使它设置为静态数字),并且还会出现大量闪烁 这是我所有的互动。它是一组排列成圆形的椭圆,带有文本标签和路径,将它们彼此连接起来。(D3上的捆绑布局)。在mouseover上,仅显示您鼠标悬停的节点以及相关连接的节点和路径。然而,如果我

每当我真的很快地将鼠标移到元素上时,最终的结果是不可预测的

在D3中有没有一种分层转换的方法可以防止这个问题,或者这只是你必须解决的问题 是否需要将元素放置得更远

我还尝试使用mousemove,这样在元素上不断移动会将其刷新到正确的状态,但元素会随着移动而变大(即使它设置为静态数字),并且还会出现大量闪烁

这是我所有的互动。它是一组排列成圆形的椭圆,带有文本标签和路径,将它们彼此连接起来。(D3上的捆绑布局)。在mouseover上,仅显示您鼠标悬停的节点以及相关连接的节点和路径。然而,如果我从一个椭圆到另一个椭圆的速度真的很快,椭圆的大小会改变,但是路径是不可预测的。我必须故意将鼠标从椭圆中移出,然后从没有侦听器的区域返回

 nodeGroup.on("mouseenter",function(){

  //hides ALL circles 
  svg.selectAll("ellipse")
     .style("opacity","0");

  //reshow the one you mouse over
  d3.select(this).select("ellipse")
    .style("opacity","1")
    .transition()
    .attr("rx", magnifiedCircle)
    .attr("ry", magnifiedCircle/2);

  //make text bigger
  d3.select(this).select("text")
    //.transition()
    .style("font-size","25");

  //remove all paths (draw relevant ones below)
  d3.selectAll("path")
    .style("opacity",0);

  //name of selected node
  var thisID = (d3.select(this).attr("id"));

  //draw alls path related to selected node
  nodeGroup.selectAll("path")
           .style("opacity", function(d,i){
              if(d[0] == thisID){

                  //draw related circles
                  svg.selectAll("#Circle_" + trimWhitespace(d[1]))
                     .style("opacity", 1);
                  svg.select("#Circle_" + trimWhitespace(d[0]))
                     .style("opacity", 1);

                return 1;
              }
              else 
                return 0;
           });

好的,我通过移除鼠标退出的过渡来修复它。我认为作为出口的一般经验法则,不应该有过渡,这样就不会有一段时间出现竞争情况。那么唯一可能出现的问题就是重叠侦听器


尽管我仍然不知道为什么mousemove会导致文本不断增长,或者为什么会出现闪烁。

您是否在寻找一种方法,在指针接触元素时立即触发mousemove事件?到底是什么问题?什么是不可预测的结果?你希望它表现如何?你能发布代码吗?添加了详细信息