react-force-graph icon indicating copy to clipboard operation
react-force-graph copied to clipboard

Custom Material given to linkMaterial not used

Open HansvdLaan opened this issue 3 years ago • 2 comments

Not sure if this is a bug or if I misunderstand the property. It seems as the custom material given to linkMaterial is not used.

Example:

<ForceGraph3D
        graphData={data}
        nodeLabel="id"
        linkWidth={edge => 3}
        linkMaterial={link => {
          new MeshLambertMaterial({
            color: Math.random() * 0xffffff,
            opacity: 1,
            transparent: true
          });
        }}
      />

Output: image

CodeSandbox: https://codesandbox.io/s/link-material-3cuz1?file=/src/index.js:805-809

HansvdLaan avatar Aug 04 '20 13:08 HansvdLaan

@HansvdLaan you're not returning anything in your linkMaterial function. If you change it to the following it should start working. 😃

linkMaterial={link => {
  return new MeshLambertMaterial({
     color: Math.random() * 0xffffff,
     opacity: 1,
     transparent: true
   });
}}

vasturiano avatar Aug 05 '20 05:08 vasturiano

.... 🤦‍♂️

Thanks!

HansvdLaan avatar Aug 05 '20 07:08 HansvdLaan