Skip to content
This repository was archived by the owner on Jan 30, 2021. It is now read-only.
This repository was archived by the owner on Jan 30, 2021. It is now read-only.

events prop integration #17

@jariverswyvel

Description

@jariverswyvel

add an object with events to handle clicks, hovers, hovers on edges, ...

const events = {
  select: ({nodes, edges}) => {
      console.log('nodes :', nodes);
      console.log('edges :', edges);
   },
  hoverEdge: ({edge}) => {
    console.log('edge :', edge);
  }
};

...

<Network options={options} events={events} style={{ height: '30rem', width: '100%' }}> 
  {nodes.map(node => (
    <Node id={node.id} key={node.id} image={node.image} decorator={this.decorator} mass={node.mass} label={node.label} />
   ))}
  {edges.map(edge => (
    <Edge label={edge.label ? edge.label : null} id={edge.id}  key={edge.id} from={edge.from} to={edge.to} />
     ))}
</Network>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions