3d-force 布局,没法中止! #7572
Unanswered
liyingji918
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
你好! 我用d3-force布局,我需要控制布局启、停;
transforms: ['process-parallel-edges'],
layout: {
type: 'd3-force',
manyBody: { strength: -300 },
link: { distance: 100, strength: 0.5 },
collide: { radius: 40, strength: 0.8 },
alpha: 0.3,
alphaDecay: 0.002,
alphaMin: 0.001,
},
behaviors: [
'zoom-canvas',
'drag-canvas',
{
type: 'drag-element-force',
key: 'drag-element-force-1',
fixed: true,
},
})
graph.value.on?.(CanvasEvent.CLICK, async (e) => {
console.log('点击画布停止布局')
问题现象:加载图形,不拖动节点,任何时候单击画布,节点停止动,看似布局停止;但是,加载图形后,先拖拽节点,再点击画布,就不起作用了,节点一直在动;只要拖动了节点,点击停止就失败了!而且,有时报layout.js:124 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getTransformInstance');去掉NodeEvent.DRAG_END事件订阅,现象一致
Beta Was this translation helpful? Give feedback.
All reactions