#How to get handle positions and dimensions

1 messages · Page 1 of 1 (latest)

vestal arrow
#

I'm using ReactFlow version 11.6.0. I'm working on using the elkjs library for graph layout. We're using handles with our graph nodes in such a way that they are at particular positions on the node (as opposed to evenly distributed on an edge). So to make elkjs aware of handles, I need to feed it the handle positions and dimensions. Right now I'm using ReactFlow internals to do this.

  const store = useStoreApi();
  const {nodeInternals} = store.getState();
  // Then using each node's internal representation to access its `handleBounds`.

Is there a different way to do this that doesn't use the internals? Could this API potentially change in future versions?

Thanks for the help!

marsh coyote
#

The internals property of the node is still intact in future versions, with handleBounds present.

Just the name of nodeInternals from the store has changed to nodeLookup in ReactFlow 12. You can take a look at it here

Also this page will take you to the migration docs of ReactFlow 12 so you can see the new changes ReactFlow 12 has. ReactFlow 12 is the latest major version.