Skip to content

Redraw with new positions #358

Answered by briangregoryholmes
jkanel asked this question in Q&A
Discussion options

You must be logged in to vote

In a custom Node, you can access the underlying store object via the following code in a script tag.

const graph = getContext('graph');
let internalNode;

onMount(() => {
    internalNode = graph.nodes.get(`N-${yourNodeID}`);
});

You could then update the position manually by calling internalNode.position.set({x, y}).

This isn't really for external use and I don't recommend building something around this functionality as it is subject to change. The next version, which will release in a few weeks, will have exported functions and stores on the major components that you will be able to access via component instance binding. This is how we plan on enabling this kind of functionality going f…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jkanel
Comment options

Answer selected by jkanel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants