vasturiano/force-graph

Can't use other methods after using d3Force

Opened this issue · 1 comments

ykvou commented

Hi @vasturiano
Describe the bug
I can't use other methods after using d3Force.

To Reproduce

  1. Set d3Force
    Graph.d3Force('link').distance(40)
  2. Set other method like linkDirectionalArrowRelPos
    Graph.d3Force('link').distance(40).linkDirectionalArrowRelPos(1)
  3. Report an error
    image

When the last method used is d3Force, it returns a force method
image
But other methods it returns a comp
image

@ykvou that is expected. Invoking d3Force like so: d3Force('link') is in getter mode, returning the force plugin with the link id.

The setter mode syntax would be adding a function after the id, like:

d3Force('myForce', () => { ... })

In this case, the method will behave like a regular setter and you can chain it.