antvis/G6

使用force的时候,使用鼠标拖拽节点的时候(拖拽的过程中),发现节点抖动,节点的位置发生偏移 #5127

dusk877647949 posted onGitHub

Describe the bug

使用的官方的例子, image

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


hi @dusk877647949, welcome!

posted by github-actions[bot] over 1 year ago

Hi @dusk877647949, Please star this repo if you find it useful! Thanks :star:! 你好 @dusk877647949。如果该仓库对你有用,可以 star 一下,感谢你的 :star:!

posted by github-actions[bot] over 1 year ago

请问解决了吗

posted by HogoZhang over 1 year ago

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

posted by github-actions[bot] 10 months ago

Fund this Issue

$0.00
Funded

Pull requests