d3.js v5.4.0中的拖动问题

问题描述 投票:1回答:1

我正在尝试使用this实现d3.js v5.4.0示例。

但是您可以看到here和此处:enter image description here

即使没有引发错误,该节点的先前图像也不会在拖动后被删除。

我调试了拖动代码,但没有找到原因。感谢提供的任何帮助。

我认为问题可能在这里:

thisGraph.drag = d3.drag()
            .subject(function(d){
                return {x: d.x, y: d.y};
            })
            .on("drag", function(args){
                thisGraph.state.justDragged = true;
                thisGraph.dragmove.call(thisGraph, args);
            })
            .on("end", function() {
                // todo check if edge-mode is selected
            });
javascript d3.js draggable drag
1个回答
0
投票

您是否正在使用Canvas?您需要运行

context.clearRect(0, 0, canvasWidth, canvasHeight);

每次渲染

© www.soinside.com 2019 - 2024. All rights reserved.