d3/d3-force

Cant pass extra data in nodes in simulation.nodes function

elVengador opened this issue · 1 comments

I want to pass extra data like nodeId to use later
For example find a node under mouse cursor, then get nodeId and make some operations

Im building nodes inthis way:

const nodes: (SimulationNodeDatum)[] = notes.map(c => Object.create(c))

all extra data from notes is removed
if I force like this:

const nodes: (SimulationNodeDatum)[] = notes.map(c => Object.create({ ...c, tmp: true }))

I have an error:
image