antvis/G6




The issue has been closed
使用force的时候,使用鼠标拖拽节点的时候(拖拽的过程中),发现节点抖动,节点的位置发生偏移 #5127
dusk877647949 posted onGitHub
Describe the bug
使用的官方的例子,
graph.on('node:dragstart', function (e) {
graph.layout();
refreshDragedNodePosition(e);
});
graph.on('node:drag', function (e) {
const forceLayout = graph.get('layoutController').layoutMethods[0];
forceLayout.execute();
refreshDragedNodePosition(e);
});
graph.on('node:dragend', function (e) {
e.item.get('model').fx = null;
e.item.get('model').fy = null;
});
});
function refreshDragedNodePosition(e) { const model = e.item.get('model'); model.fx = e.x; model.fy = e.y; }
Your Example Website or App
https://antv-g6.gitee.io/zh/examples/net/forceDirected#forceDirectedPreventOverlap
Steps to Reproduce the Bug or Issue
1
Expected behavior
1
Screenshots or Videos
No response
Platform
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response